define variable use in root project of multiproject


Is it possible to create variable/property in and use it in multiproject root project tasks?

I need bootstrap task to checkout project structure from cvs (20 - 25 cvs modules).

Currently I have settings.propertis with project includes + some logic not to include optional projects:

def addOptionalProject(String projectDir){
      if (file(projectDir).exists()){
        include projectDir
        println "Optional project added. Project ${projectDir}"

I would like to be able to checkout all cvs modules/sub-projects.

I need checkout projects which are optional and are not included in actual sub-projects list and I thought best way would be create list of project names in and use it in custom task to perform cvs checkout and in loop in to include projects while building after checkout.

Is it possible? Do you think there is better way to avoid duplicate project definition in and in my task/plugin configuration in build.gradle?


Regards, Zdenek

no need for cvs more.

I use custom gradle config file to define projects and its types, this is used in settings.gradle and in the installer to generate dependencies during config phase.

One way to get information across is via an extra property on the ‘gradle’ object.

settings.gradle = "bar"



If setting a value on the extra property of the gradle object, does it always have to be referenced via “” from within the build.gradle as well?

Is there a way to set the property in the settings.gradle file so that from within any project in a multi-project build, the said property could simply be referenced from either “”, or even just “foo”?

Try ‘ = “bar”’. Then you should be able to refer to the property as ‘foo’ from anywhere.

Thanks Peter for your help with this. For what it is worth, when attempting what you suggested resulted in the following:

This was using Gradle v1.10. Don’t know if this if a bug or what, but wanted to let you know.

Thanks again!

I don’t think it’s a bug. ‘ = “foo”’ and ‘println foo’ seems like the correct solution.