user3616128
user3616128

Reputation: 377

Execution of ant file within exec task

I want to run my ant i.e. build.xml file in parallel execution along with the ongoing execution of a task. I am using Exec task to achieve this. i.e. I am using ant to run the build.xml file within Exec task but facing the following error: ERROR: exec doesn't support the nested "ant" element.

My excerpt of the code is:

<if>
    <istrue value="${parallel.exec}" />
    <then>

        <!-- Parallel execution of task -->
        <mkdir dir="${buildroot.dir}/product/${build-log.dir}" />
        <exec dir="../../apollo" executable="/bin/sh" spawn="true">
            <ant antfile="${buildroot.dir}/product/abs-build.xml" />
        </exec>
    </then>

Upvotes: 0

Views: 1645

Answers (2)

user4524982
user4524982

Reputation:

We'll, <exec> simply doesn't support arbitrary tasks as nested elements, just what the manual page lists.

In order to run Ant you'd use something like

<exec dir="../../apollo" executable="/bin/sh" spawn="true">
    <arg value="${ant.home}/bin/ant"/>
    <arg value="-f"/>
    <arg file="${buildroot.dir}/product/abs-build.xml" />
</exec>

Upvotes: 1

0o&#39;-Varun-&#39;o0
0o&#39;-Varun-&#39;o0

Reputation: 735

You can try to create a target like this

<target name="antcaller">
 <ant antfile="yourantfile" target="do something" />
 ...

and then can call it

Upvotes: 0

Related Questions