ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: Ant Java API Question
Date Thu, 17 Jun 2004 13:16:15 GMT
I'd suggest you set the logging level to DEBUG and get some more idea 
about what is happening. I'm not sure you've initialized the project 
object fully (maybe basedir property is causing an issue).

Conor


Shay wrote:

> 
> I'm having a problem with calling ant scripts from the API and I was 
> hoping someone might know the solution.
> 
> Let's say you have 2 ant scripts, A and B.  The main target in A calls a 
> target in B.  Now if I use the java API to call A, it should in turn 
> call B, but it's not.  Instead, it just returns and I don't see an error 
> or anything.
> 
> Now if I run via the command line, A will call B.  I can also call B 
> directly from the API and then B's target will successfully run.
> 
> Am I just missing something when I create my project?  My code is at the 
> bottom.
> 
> Thanks,
> Shay
> 
> final Project project = new Project();
> project.init();
> final BuildLogger logger = new NoBannerLogger();
> 
> logger.setMessageOutputLevel(Project.MSG_INFO);
> logger.setOutputPrintStream(System.out);
> logger.setErrorPrintStream(System.err);
> project.addBuildListener(logger);
> Ant aScript = (Ant) project.createTask("ant");
> try {
>         aScript.setDir(new File(inScriptPath));
>         aScript.setAntfile(fBuildScript.getCanonicalPath());
>         aScript.setTarget(inTask);
>         aScript.execute();
> 
> } catch (Exception e) {
>         e.printStackTrace();
> }
> 
> 
> 
> 
> Give a man a fish, and you feed him for a day.  Tell him he should learn 
> how
> to fish himself, and he'll hate you for a lifetime.
> 
> Shay Thompson - sthompso@adobe.com
> Adobe Systems, Bedrock Team
> Voice: x34728 or 651.766.4728
> 

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


Mime
View raw message