May 27

Sometimes you need to pass an argument on the command line to be used by your Ant build.

You can achieve this by passing it as a system property using the -D option. eg.

ant -Dmyarg=abc build

You can then access that system property in your build script as ${myarg}. eg. The following will replace all occurrences of ‘@@@’ with the value of myarg specified on the command line (‘abc’ in the above example)

<replace dir="${src}" token="@@@" value="${myarg}">
  <include name="**/*.html"/>

written by objects \\ tags: , , ,

Leave a Reply

You must be logged in to post a comment.