Calling Ant from within Java is actually quite easy using the Project
class. See the BuildFileTest configureProject() and execute() methods
for an example (cf.
http://cvs.apache.org/viewcvs.cgi/ant/src/testcases/org/apache/tools/ant/BuildFileTest.java?rev=1.29&view=auto).

Fred Loney
Spirited Software, Inc.
www.spiritedsw.com

----- Original Message ----- 
From: "bertrand lancelot" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 24, 2004 8:16 AM
Subject: Call Ant within my java application


> Hi all,
>
> I need to call ANT within my Java application.
>
> first, I tried to execute the class "org.apache.tools.ant.Main" with
> properties from my application. After ANT starts, the JVM breaks with
> System.exit usage. As a result my application shutdown too!
>
> So, I would like to extend the Main class and override the method :
> public void startAnt(String[] args, Properties
additionalUserProperties,
> ClassLoader coreLoader)
>
> Problem :
> This method "startAnt" uses "processArgs", "handleLogfile",
"printMessage",
> "runBuild" methods and the attribute "definedProps" which are
"private".
>
> Question :
> Is it possible to change the modifier of theses methods from "private"
to
> "protected final", and to declare a getter for "definedProps" field ?
>
> Unfortunetly, to resolv this I'd have to copy all source from
Main.java in
> my project without System.exit usage.
>
> In the case where this usage is not correct, please say it to me and
give me
> the best practice for this situation.
> ;o)
>
> Sincerly,
> Bertrand,
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to