On Sep 3, 2009, at 12:51 PM, Donal Mc Namee wrote:

Can anyone tell me how I can pass a specific 'version' to a sub- project
when executing a build?

For example, I want to define the version for sub-project-1 as '1.0' and
sub-project-2 as '1.2' at build time.

I've tried such things a providing '-Psub-project-1:version=1.0' or
'-Psub-project-1.version=1.0' on the Gradle command line

At the moment project properties you set on the command line are available in any subproject. I think it would be a good feature to be able to specify them selectively on the command line. Could you file a Jira for this?

Meanwhile you could set the properties like above and write in the build.gradle of the subproject:

sub-project1
- build.gradle
-- version = subproject1Version ?: '1.0' // We use the Groovy elvis operator. If subproject1Version is set we use that value, otherwise the deault '1.0' value

sub-project2
- build.gradle
-- version = subproject2Version ?: '1.0'

The problem with that approach is that the build.gradle needs to be customized. With Gradle 0.8 you could use an init.gradle to achieve something similar without touching the build.gradle. But, as said, the best approach would be to be able to set this property directly for a subproject.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to