Using doLast from top level build script

View: New views
4 Messages — Rating Filter:   Alert me  

Using doLast from top level build script

by Peter Voss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

first of all congratulations to gradle. I have just successfully  
migrated a multi-project web application from Maven to gradle and was  
surprised how easy this is now. The user guide was very helpful.

I now want to extend the eclipseClean task to also remove  
the .settings directory. I using this in one of my sub projects:
eclipseClean.doLast {
     ant.delete(dir: ".settings")
}

That works, but I want to have this for all of my subprojects, so I  
tried this from the top level build script, but failed:
subprojects {
     usePlugin "eclipse"

     eclipseClean.doLast {
         ant.delete(dir: ".settings")
     }
}

But this doesn't work anymore:
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/pvoss/Documents/horizont/git/webproject/
build.gradle' line: 4

* What went wrong:
A problem occurred evaluating root project 'webproject'.
Cause: Could not find property 'eclipseClean' on project ':integration-
tests'.

Any ideas?

--Peter

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

    http://xircles.codehaus.org/manage_email



Re: Using doLast from top level build script

by Peter Voss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have figured it out on my own.

On 20.10.2009, at 12:38, Peter Voss wrote:

> Hi,
>
> first of all congratulations to gradle. I have just successfully  
> migrated a multi-project web application from Maven to gradle and  
> was surprised how easy this is now. The user guide was very helpful.
>
> I now want to extend the eclipseClean task to also remove  
> the .settings directory. I using this in one of my sub projects:
> eclipseClean.doLast {
>    ant.delete(dir: ".settings")
> }
>
> That works, but I want to have this for all of my subprojects, so I  
> tried this from the top level build script, but failed:
> subprojects {
>    usePlugin "eclipse"
>
>    eclipseClean.doLast {
>        ant.delete(dir: ".settings")
>    }
> }
>

this should be:

subprojects {
     usePlugin "eclipse"

     afterEvaluate {project ->
         project.tasks["eclipseClean"].doLast {
             ant.delete(dir: "${project.projectDir}/.settings")
         }
     }
}

This works. :-)

--Peter


> But this doesn't work anymore:
> FAILURE: Build failed with an exception.
>
> * Where:
> Build file '/Users/pvoss/Documents/horizont/git/webproject/
> build.gradle' line: 4
>
> * What went wrong:
> A problem occurred evaluating root project 'webproject'.
> Cause: Could not find property 'eclipseClean' on project  
> ':integration-tests'.
>
> Any ideas?
>
> --Peter
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>


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

    http://xircles.codehaus.org/manage_email



Re: Using doLast from top level build script

by levi_h :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could even say project.eclipseClean instead of project.tasks['eclipseClean'] if I'm not mistaken.

On Tue, Oct 20, 2009 at 6:10 PM, Peter Voss <info@...> wrote:
Hi,

I have figured it out on my own.


On 20.10.2009, at 12:38, Peter Voss wrote:

Hi,

first of all congratulations to gradle. I have just successfully migrated a multi-project web application from Maven to gradle and was surprised how easy this is now. The user guide was very helpful.

I now want to extend the eclipseClean task to also remove the .settings directory. I using this in one of my sub projects:
eclipseClean.doLast {
  ant.delete(dir: ".settings")
}

That works, but I want to have this for all of my subprojects, so I tried this from the top level build script, but failed:
subprojects {
  usePlugin "eclipse"

  eclipseClean.doLast {
      ant.delete(dir: ".settings")
  }
}


this should be:

subprojects {
   usePlugin "eclipse"

   afterEvaluate {project ->
       project.tasks["eclipseClean"].doLast {
           ant.delete(dir: "${project.projectDir}/.settings")
       }
   }
}

This works. :-)

--Peter



But this doesn't work anymore:
FAILURE: Build failed with an exception.

* Where:
Build file '/Users/pvoss/Documents/horizont/git/webproject/build.gradle' line: 4

* What went wrong:
A problem occurred evaluating root project 'webproject'.
Cause: Could not find property 'eclipseClean' on project ':integration-tests'.

Any ideas?

--Peter

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

 http://xircles.codehaus.org/manage_email




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

  http://xircles.codehaus.org/manage_email




Re: Using doLast from top level build script

by Peter Voss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, thanks. That works as well and cleans up my build a little bit  
more. :-)

--Peter

On 21.10.2009, at 00:09, Levi Hoogenberg wrote:

> You could even say project.eclipseClean instead of  
> project.tasks['eclipseClean'] if I'm not mistaken.
>
> On Tue, Oct 20, 2009 at 6:10 PM, Peter Voss <info@...>  
> wrote:
> Hi,
>
> I have figured it out on my own.
>
>
> On 20.10.2009, at 12:38, Peter Voss wrote:
>
> Hi,
>
> first of all congratulations to gradle. I have just successfully  
> migrated a multi-project web application from Maven to gradle and  
> was surprised how easy this is now. The user guide was very helpful.
>
> I now want to extend the eclipseClean task to also remove  
> the .settings directory. I using this in one of my sub projects:
> eclipseClean.doLast {
>   ant.delete(dir: ".settings")
> }
>
> That works, but I want to have this for all of my subprojects, so I  
> tried this from the top level build script, but failed:
> subprojects {
>   usePlugin "eclipse"
>
>   eclipseClean.doLast {
>       ant.delete(dir: ".settings")
>   }
> }
>
>
> this should be:
>
> subprojects {
>    usePlugin "eclipse"
>
>    afterEvaluate {project ->
>        project.tasks["eclipseClean"].doLast {
>            ant.delete(dir: "${project.projectDir}/.settings")
>        }
>    }
> }
>
> This works. :-)
>
> --Peter
>
>
>
> But this doesn't work anymore:
> FAILURE: Build failed with an exception.
>
> * Where:
> Build file '/Users/pvoss/Documents/horizont/git/webproject/
> build.gradle' line: 4
>
> * What went wrong:
> A problem occurred evaluating root project 'webproject'.
> Cause: Could not find property 'eclipseClean' on project  
> ':integration-tests'.
>
> Any ideas?
>
> --Peter
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>  http://xircles.codehaus.org/manage_email
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>


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

    http://xircles.codehaus.org/manage_email