ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shay <sthom...@adobe.com>
Subject Ant Java API Question
Date Wed, 16 Jun 2004 14:27:13 GMT

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message