Best practice for using the same distributionUrl across projects


(Aaron Perrin) #1

I have a gradle project that includes many other gradle projects. The way I do this is through use of include and project.projectDir.

For example:

in …/core-project/settings.gradle

include ':dependency-project'
project(':dependency-project').projectDir = new File(settingsDir, '../dependency-project')

Note: I don’t know if this is a best practice, but it has worked for me. Please point out a better way, if there is one. Unfortunately, I can’t use composite because it doesn’t support nested projects.

Anyway, each of the dependency projects can be used separately, or they may be included in other projects using the method above. However, each project also has its own gradlew and Because of this, each project also defines its own distributionUrl property.

So, when I go to upgrade gradle, I have to manually edit the distributionUrl property in all of the projects.

Is there a way that I can define the value of distributionUrl outside of all of the projects and include it? I know that I can do this using external methods, but I am hoping that gradle has support for this.