Gradle "gradle-wrapper.properties" dynamic/configurable distributionUrl

Viewed 2159

I have a gradle project, we use the gradlew.sh to build it.

The same GIT project/branch is used by two different teams.

The two teams have two different jenkins instances which contains the automation to build the project.

Now assuming that both the two teams jenkins automations clone and checkout same project and branch, I want the to use two different values for the distributionUrl for the two teams

This because the first team cannot access to the distributionUrl of the second team and vice versa

Is there anyway to make this value dynamic, eg pass it from command line, use env variable or something else?

I tried it all but it does not work, gradle is always taking the value specified in gradle-wrapper.properties distributionUrl, without giving me any change of overriding it.

Please if my question is no clear or you want any further information feel free to let me know and I will update my question.

2 Answers

It is currently not possible to dynamically pass the distribution URL to the gradle wrapper. So I recommend doing this in Jenkins:

Put shell script step before the actual Gradle build step in Jenkins and and rewrite the gradle-wrapper.properties in that shell script step.

Related