Gradle does not combine all tasks given on the command line but performs
separate builds for each task. For example if you do "gradle resources
compile" it does
- (create tasks)
- init
- resources
- (create tasks)
- init
- resources
- compile

You can do something like "gradle -PmyProperty=foo resources", which sets
the property on the project, e.g. println "My property is: ${myProperty}" //
that's Groovy ;-)


Allan Lewis wrote:
> 
> I'm looking to set a custom property on my resources task to one of a
> number of values, and was thinking of doing something like the following:
> 
> createTask('foo') {
>       resources.myProperty = "foo"
> }
> 
> I'd then read this value when the build gets to the resources task:
> 
> resources.doFirst() {
>       System.out.println("My property is: " + resources.myProperty);
> }
> 
> I figured that I could do 'gradle foo resources', and have the value of
> this property set to 'foo' by the time I get to the resources task. 
> However, all I get is this error:
> 
> Cause: Property 'myProperty' not found for task :koios-tests:resources.
> 
> What am I doing wrong?  Is there a way to achieve what I'm after?
> 

-- 
View this message in context: 
http://www.nabble.com/Why-does-this-not-work--tp21925487p21928597.html
Sent from the gradle-user mailing list archive at Nabble.com.


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

    http://xircles.codehaus.org/manage_email


Reply via email to