Discover Distribution URL from flag/environment/etc?

Hello Gradle community,

from what I understand, currently there is no way of changing the gradle distribution url, other than by editing the

In my CI there is no internet and I need to build projects in different environments, so I’d like to pass it in as a parameter, environment variable or gradle property.

Is there any such thing already and if not, what would be the preferred way of doing this? I’m happy to implement it and add a PR.


I assume there is some company server that both your CI and developer machines can reach? Then the best solution is hosting the Gradle distribution there and point the wrapper there.

Hi Stefan, unfortunately in our use case our architecture doesn’t allow having one central server that will always be reachable. We have multiple completely decoupled networks, so this unfortunately is not an option.

Any opinion on which way I should implement this? As said - very happy to submit a PR.

DNS can solve this quite easily. Just resolve the URL to whatever server is appropriate for the given environment.

Of course you could just install Gradle in the environment and call it directly. But the problem with any approach that doesn’t use a checked-in wrapper is that builds wouldn’t be reproducible. That’s why I strongly recommend putting a URL in your and making that URL resolve properly in each environment.