Search code examples
javaxmlantbuild.xml

Invoke multiple build scripts from single build script ? build.xml


I have 3 build scripts, each creates a jar file.

  • build1.xml -> build1.jar
  • build2.xml -> build2.jar
  • build3.xml -> build3.jar

How to call all these build scripts from a single build.xml ?

Tried below script(build.xml), but it always calling only 1 script (build1.xml) and creates build1.jar and flow exit. Not processing other 2 build scripts (build2.xml and build3.xml).

Please suggest.

<project name="Message Broker Build - DOCGEN" default="all">

<import file="build1.xml"/>
<import file="build2.xml"/> 
<import file="build3.xml"/>


<target name="all" depends="build1, build2, build3"></target>

</project>

Solution

  • You can run apache ant on other script files using the ant task.

    <ant antfile="build1.xml" />
    <ant antfile="build2.xml" />
    <ant antfile="build3.xml" />
    

    A target within each file can be specified with the target option.