Milhous
Milhous

Reputation: 14643

Ant meta build

In ant, is there a way to combine multiple ant builds to deploy to a meta-project. For example I have

workspace/project1/build.xml
workspace/project2/build.xml

and I want to make

workspace/build.xml

that will run specific targets in project1 and project2.

Upvotes: 2

Views: 326

Answers (4)

Yishai
Yishai

Reputation: 91881

The ant task does this. In addition there is also an import task which can allow you to make the sub-Ant files as part of the larger project file. But realistically you would probably only do that if the sub-project's Ant file was built for that in the first place.

Upvotes: 3

Jason Day
Jason Day

Reputation: 8839

I would recommend the subant task instead of either ant or antcall. For the example above, use the following in workspace/build.xml:

<subant target="target">
    <fileset dir="${basedir}" includes="project*/build.xml"/>
</subant>

Refine the fileset as needed to pick up all the project subdirectories (use **/build.xml to pick up all subdirectories that contain a build.xml file).

Upvotes: 4

jjb
jjb

Reputation: 3570

I think that's backwards, isn't it? "ant" allows you to specify another build file, while "antcall" is just for calling a particular target.

Upvotes: 1

skaffman
skaffman

Reputation: 403481

The "antcall" task is probably what you need. It allows you to invoke specific targets in other ant files. You can optionally transfer all currently defined properties and references to the invoked target.

Note that this isn't to be confused with the "ant" target, which is for invoking targets in the current ant file.

Upvotes: 0

Related Questions