Ant build scripts, antcall, dependencies, etc

Question :

Ant build scripts, antcall, dependencies, etc,

Answer :

I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to date.

So I know I need to import the utils build file.


Which doesn’t work because the import task, unlike almost every other ant taks, doesn’t run from basedir, it runs from the pwd. So to get around that I have this little ditty, which does successfully import the build file


So now that ive solved my import problem I need to call the task, well that should be easy right:


note that in the above, utils is the project name of ../utils/build/build.xml

the problem I’m now running into is that ant call doesn’t execute in ../utils/build so what I need, and cant find, is a runat property or something similar, essentially:


The reason I need this is that in my utils build file the step to select which code to copy to the jar is based on relative paths so as to avoid hardcoding paths in my ant file. Any ideas?


I’ve got something similar set up: I have a main Ant build.xml which calls a separate build.xml that takes care of building my tests. This is how I do it:


The trick is to use subant instead of antcall. You don’t have to import the other build file.

That’s the answer Ant build scripts, antcall, dependencies, etc, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you

Read More  YUI drag&drop proxy drag