On Feb 10, 2009, at 1:50 AM, 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?

The current default of Gradle is to execute a task name list specified on the command line in isolation (as pointed out by Martin). But if you choose the -m command line option, all is executed as one build and the stuff above should work. For 0.6 we want to make the -m behavior the default, and in fact only way, how Gradle executes multiple tasks. If you want isolation, you can do: gradle foo && gradle resources.

- Hans


--
View this message in context: 
http://www.nabble.com/Why-does-this-not-work--tp21925487p21925487.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



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





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

   http://xircles.codehaus.org/manage_email


Reply via email to