Hi Andrew,
you run into the same issue Eric just does. see http://gradle.1045684.n5.nabble.com/Confused-on-defining-tasks-td2642940.html#a2642940

Am 24.08.10 19:51, schrieb Andrew Schetinin:
Hi,

I tried to define a default task "help" which would run if no other task is specified (in a multi-project build). It worked fine, but I was surprised to learn that when I specify some other task (like "build"), the default "help" task runs before it anyway. I thought that default tasks should only run when nothing else is specified... this is how the documentation explains it...
Did I misunderstand something? :-)

This is how I defined it in the master build.gradle:

defaultTasks "help"

task help {
    println ""
    println "Common commands:"
    println ""
    println " ***** clean full rebuild with tests ***** "
    println "    time gradle clean build"
    println ""
    println " ***** fast build without tests ***** "
    println "    time gradle build -xtest"
    println ""
}
the println statements are executed during gradles configuration phase. the task has no taskaction declared.

if you define your help task with the << shortcut to declare a task and add an action you should get the expected behaviour:

task help << {
    println ""
    println "Common commands:"
    println ""
    println " ***** clean full rebuild with tests ***** "
    println "    time gradle clean build"
    println ""
    println " ***** fast build without tests ***** "
    println "    time gradle build -xtest"
    println ""
}

regards,


--
------------------------------------
Rene Groeschke

[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------


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

   http://xircles.codehaus.org/manage_email


Reply via email to