ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Calling Ant from Java: An example please ?
Date Wed, 13 Feb 2002 22:11:14 GMT
Jay Riddell wrote:

> Yes, I am TRYING to do that.
> But I am failing miserably.
> There are NO EXAMPLES on how to do this; there is only Javadoc
> on the API itself (with very little extra explanatory text).
> OK, maybe I am not being specific enough here.
> Here is the java code that I have written that attempts
> to compile a "Hello, world" java file:
> And here are the results that I get:

You could look at Ant's testcases which contain the following code

     protected void configureProject(String filename) {
         logBuffer = new StringBuffer();
         fullLogBuffer = new StringBuffer();
         project = new Project();
         project.setUserProperty( "ant.file" , new 
File(filename).getAbsolutePath() );
         project.addBuildListener(new AntTestListener());
         ProjectHelper.configureProject(project, new File(filename));

What you would need to do then would be to replace the ProjectHelper 
call with one that creates your targets and tasks, etc.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message