Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass a parameter to an <ant ../> call?

Tags:

ant

I have a master build file which is calling other build.xml files of different projects.

One of my build file needs a command line argument for the execution

ant -Denv=81 -buildfile build_war.xml

I wrote one task in master build.xml to call build_war.xml

<target name="buildDataExtractor">
  <ant antfile="..\SEFTooling\build_war.xml" inheritall="false" /> 
</target>

How do I pass the "-Denv=81" parameter so that build_war.xml will be executed correctly.

like image 340
Amrin Avatar asked Sep 14 '25 12:09

Amrin


1 Answers

Try passing properties to the ant task:

<ant antfile="..\SEFTooling\build_war.xml" inheritall="false">
  <property name="env" value="${env}"/>
</ant>

NOTE: in order for this to work properly, you will need to call your main build with ant -Denv=81 or set a property in the main build.xml as such:

<property name="env" value="81"/>
like image 178
Attila Avatar answered Sep 17 '25 18:09

Attila



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!