ant file that depends on another ant file

2020-08-11 10:47发布

问题:

I have two projects, each with its own ant build file.

What should I do so that, when I build project B, it will first build project A using project A's antfile?

回答1:

You can achieve this by using the ant task, which runs ant on an external buildfile.

Example:

<ant antfile="../otherproject/build.xml" target="compile"/>

Properties
By default all current properties are passed to the invoked ant build, this can be disabled by setting inheritAll="false", if you want the other build to behave natively.

Properties that are need can be passed by nested tags:

<ant inheritAll="false" antfile="../otherproject/build.xml" target="compile">
  <property name="my.property" value="myValue"/>
</ant>


标签: ant