Reputation: 1291
I'm having a list of projects each with ant build script, I need to write anther ant script that call all the other scripts (i.e: build all the projects from one build script), I thought of something like that:
<?xml version="1.0"?>
<project basedir="../path/of/the/destination/project" default="build" name="Main Builder">
<target name="build">
<ant antfile="first.xml"/>
<ant antfile="second.xml"/>
<!--And so on-->
</target>
</project>
The problem is that the basedir
attribute has to be the one of the project to be built, and so needs to be changed each time before building the next project.
How can I do so?
Upvotes: 2
Views: 10252
Reputation: 1291
Found that ant
task takes an attribute dir
that defines where to execute the ant script, so it'll be like that:
<?xml version="1.0"?>
<project basedir="../path/of/the/parent/directory" default="build" name="Main Builder">
<target name="build">
<ant antfile="buildScript1.xml" dir="project1"/>
<ant antfile="buildScript2.xml" dir="project1"/>
<ant antfile="buildScript3.xml" dir="project1"/>
<!--And so on-->
</target>
</project>
Upvotes: 5
Reputation: 7836
You basedir
should point to the directory which contain all projects and then give the relative path in antfile
. Do it like this:
<?xml version="1.0"?>
<project basedir="../path/of/the/destination" default="build" name="Main Builder">
<target name="build">
<ant antfile="project1/buildScript.xml"/>
<ant antfile="project2/buildScript.xml"/>
<ant antfile="project3/buildScript.xml"/>
<!--And so on-->
</target>
</project>
Upvotes: 0