Return to Snippet

Revision: 9818
at November 24, 2008 06:41 by narkisr


Initial Code
import org.apache.tools.ant.ProjectHelper
import org.apache.tools.ant.Project
import org.apache.tools.ant.BuildException

public void invoke(){
 File antFile = new File("build.xml")

 Project project = new Project()
 project.init()
 ProjectHelper.projectHelper.parse(project, antFile)

 try{
   project.executeTarget('echo-1')
 } catch (BuildException e) {
     println e.location
 }
}

Initial URL

                                

Initial Description
An example on how to invoke Ant targets which are defined in build.xml.

Initial Title
Running an Ant target programmaticly

Initial Tags
java, groovy

Initial Language
Groovy