ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Cody <paul.c...@lucida.com>
Subject RE: Calling Ant from Java: An example please ?
Date Wed, 13 Feb 2002 21:11:47 GMT
> 
> On Wednesday 13 February 2002 18:49, you wrote:
> > Thanks for the quick response  . . . but no ;-)
> >
> > I want to accomplish this in Java by calling the Ant API.
> >
> > I need to dynamically:
> >   - generate source code
> >   - compile what was generated
> >   - classload it
> >   - execute it
> >
> > And I need to do all this as part of a larger application.
> >
> > How's THAT for fun ?
> >

FYI:  I wrote a tool called 'jenesis' [ http://www.inxar.org/jenesis ] that
is used to generate sourcecode.  You can use it to do the emit, compile, and
reflect steps within a running application.

As for using ant within your application, here's what I do:

File buildFile = ...
Project project = new Project();
project.addBuildListener(new Log4JListener());
project.init();
project.setUserProperty("ant.file", buildFile.getAbsolutePath());
ProjectHelper.configureProject(project, buildFile);
project.executeTarget("compile");

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message