ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Calling Ant from Java: An example please ?
Date Wed, 13 Feb 2002 21:40:13 GMT

----- Original Message -----
From: "Jay Riddell" <jay@theriddells.org>
To: "Ant Users List" <ant-user@jakarta.apache.org>; "Diane Holt"
<holtdl@yahoo.com>
Sent: Wednesday, February 13, 2002 10:49
Subject: Re: Calling Ant from Java: An example please ?


> 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.
>

If you were using C#, you could use CodeDOM for this, but in java you have
more work cut out for you.

1. at its simplest, you can always exec() ant. This works, you just need to
set up the right calling string for your platform (like CMD.EXE ant.bat'.

2. have a look in the ant source, such as at Project.main to see how it
itself sets up and calls the ant classes.

3. IDE integration examples: you can also grab the source for AntFarm for
jEdit, that one can exec() or directly call ant, depending on your choice.

IDEs and the like set up their own build listeners to catch output; if you
dont need to do that, option (1) is simple.


--
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