ahh, gotcha. I would have expected the 'onlyIf' functionality only makes sense for tasks, and therefore would only be attempted to apply to tasks (and not to the property). But, at least I can know not to have that sort of clash now.
thanks very much, sean On 19 January 2011 10:04, Adam Murdoch <[email protected]> wrote: > > On 18/01/2011, at 12:26 PM, Sean Van Buggenum wrote: > > Hi all, > > sorry for begging for help yet again... > > i'm trying to use the 'onlyIf' functionality I found at: > http://gradle.org/more_about_tasks.html > > I have a task called 'notify'. > > Apart from setting up this task, I also want this task only to be run > in the case the 'notify' property has been set to 'true'. > So, I assumed I could do this: > > > notify.onlyIf { getProject().properties['notify']=='true' } > > When resolving names in the build script, project properties set with -P > take precedence over task names. So, if you have a property called 'notify' > and a task called 'notify', then > notify.onlyIf { ... } > will attempt to call onlyIf() on the value of the property called 'notify'. > Which fails because that value is a String. > Instead, you might do: > tasks.notify.onlyIf { ... } > Or give the property a different name. > > > Yet, I get an error: > > * What went wrong: > A problem occurred evaluating root project 'scripts'. > Cause: No signature of method: java.lang.String.onlyIf() is applicable > for argument types: > (build_gradle_1467b47dd8b3e85829e88798cc56eeb0$_run_closure10) values: > [build_gradle_1467b47dd8b3 > Possible solutions: notify(), any(), split(), any(groovy.lang.Closure) > > > I also tried the exact same example as shown on the webpage, just in > case I couldn't use the syntax i'd used.... > that also failed in the same way. > > Any idea? > > version shows this: > > D:\dev\scripts>gradle -version > > ---------------------------------------------------------- > Gradle 0.9 > ---------------------------------------------------------- > > Gradle build time: Sunday, 19 December 2010 1:42:19 PM EST > Groovy: 1.7.6 > Ant: Apache Ant version 1.8.1 compiled on April 30 2010 > Ivy: 2.2.0 > JVM: 1.6.0_18 (Sun Microsystems Inc. 16.0-b13) > OS: Windows XP 5.1 x86 > > thanks in advance! > > sean > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > > -- > Adam Murdoch > Gradle Developer > http://www.gradle.org > CTO, Gradle Inc. - Gradle Training, Support, Consulting > http://www.gradle.biz > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
