[resending -- didn't seem to make it through]
Hi,
I am looking into using Ant (v1.6.0) more in my webapp so I can offer
offline publishing equivalents. I am transforming some config XML into a
build file. I then want to load that build file into a new
org.apache.tools.ant.Project. The build.xml gets produce properly (it
runs successfully from the command line).
How do I load the build file and create an ant project, then trigger a
particular target to execute? The build file uses only Core Tasks (and
an xmlcatalog). Is there a simple example somewhere? I have tried
searching with google but getting too many hits that don't cover what I
am looking for.
Here is what I have tried:
org.apache.tools.ant.Project antProject = new
org.apache.tools.ant.Project();
AntXMLContext antContext = new AntXMLContext(antProject);
File f = lsbProject.lookup("build.xml").getFile();
System.out.println("build.xml: " + f);
antContext.setBuildFile(f);
System.out.println("project name: " + antContext.getCurrentProjectName());
Vector targets = antContext.getTargets();
for (Enumeration e = targets.elements(); e.hasMoreElements();) {
Target target = (Target) e.nextElement();
System.out.println(target.getName() + " : " + target.getDescription());
}
----------
the System.outs produce:
build.xml: c:\home\app\projects\grok\build.xml
project name: null
: null
----------
thanks for any help,
-Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]