Ah, that was it, thanks.
On Wed, Feb 16, 2011 at 4:56 PM, Rene Groeschke <[email protected]> wrote:
> Hi Brett,
> in your snippet below you execute the println command during gradles
> configuration phase. The configuration phase. Gradles execution phase
> creates the task graph before executing the task itselfs. Try this
> modified snippet of your build script (I've just added the "<<")
>
> subprojects {
> apply plugin: 'java'
>
> version = project.parent.version
>
> task customOne << {
> println "ONE: I am $project.name"
> }
>
> task customTwo << {
> println " - TWO: My parent is $project.parent.name"
> }
> }
>
>
> The << adds an action to your task. this notation is a bit irritating
> for beginners, but helpful when you get used to it.
>
> regards,
> René
>
> Am 16.02.11 15:50, schrieb Brett Cave:
> > Hi Rene,
> >
> > On Wed, Feb 16, 2011 at 4:20 PM, Rene Groeschke <[email protected]>
> wrote:
> >
> >> Hi Brett,
> >> I don't see any question in your post. In your provided example, you
> >> define a pmd task for each subproject. running "gradle pmd" executes all
> >> of them. for details have a look at
> >>
> >>
> http://gradle.org/0.9.2/docs/userguide/userguide_single.html#multi_project_builds
> >>
> > Sorry, the question was left out "Why does gradle run ALL custom tasks in
> > subprojects, whether I call them or not" - as mentioned in my original
> > email, "When I run ANYTHING on the parent, all subprojects execute PMD"
> >
> > My understanding of grade is that only invoked tasks will be called if
> there
> > are no task dependencies. I have just tested by replacing my build.gradle
> > with a much simpler one, is this behaviour correct below (i.e. the
> defined
> > tasks are always called, even when I only call the 'tasks' task)?
> >
> > subprojects {
> > apply plugin: 'java'
> >
> > version = project.parent.version
> >
> > task customOne {
> > println "ONE: I am $project.name"
> > }
> >
> > task customTwo {
> > println " - TWO: My parent is $project.parent.name"
> > }
> > }
> >
> > Thats all that I have in my build.gradle. When I run "gradle tasks", i
> get
> > the following output:
> >
> > [me@host proj1]$ gradle tasks
> > ONE: I am project-api
> > - TWO: My parent is proj1
> > ONE: I am project-client
> > - TWO: My parent is proj1
> > ONE: I am project-model
> > - TWO: My parent is proj1
> > ONE: I am project-server
> > - TWO: My parent is proj1
> > :tasks
> >
> > ------------------------------------------------------------
> > Root Project
> > ------------------------------------------------------------
> > /// The rest of "tasks" output is displayed.
> >
> >
> > So the question is: how should I correctly configure tasks so they are
> not
> > executed by every gradle call, but only when passed as an argument to
> > gradle?
> >
> >
> >> regards,
> >> René
> >>
> >> Am 16.02.11 15:04, schrieb Brett Cave:
> >>> I have a multi project gradle project, and have defined a task in the
> >>> parent:
> >>>
> >>> // start
> >>> subprojects {
> >>> apply plugin: 'java'
> >>> apply plugin: 'code-quality'
> >>>
> >>> configurations { pmdConf }
> >>> dependencies { pmdConf 'pmd:pmd:4.2.5' }
> >>>
> >>> task pmdCheck {
> >>> println "Running PMD code check on " + project.name
> >>> ant {
> >>> // the ant definition for pmd in here: a taskdef with name
> >> pmdTask
> >>> and then invoking the task.
> >>> }
> >>> }
> >>> }
> >>>
> >>> // end build.gradle
> >>>
> >>>
> >>> When I run anything on the parent, PMD is executed:
> >>> e.g. gradle compileJava
> >>> "Running PMD code check on subproject1"
> >>> "Running PMD code check on subproj2"
> >>> "Running PMD code check on subproj3"
> >>>
> >>
> >> --
> >> ------------------------------------
> >> 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
> >>
> >>
> >>
>
>
> --
> ------------------------------------
> 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
>
>
>
--
Brett Cave
Systems Architect
Jemstep, Inc
www.jemstep.com