ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fred Loney" <lo...@spiritedsw.com>
Subject Re: Call Ant within my java application
Date Thu, 24 Jun 2004 22:21:36 GMT
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" <blancelot@partner.auchan.com>
To: <dev@ant.apache.org>
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: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message