May 27

Previously we covered passing command line arguments to Ant. We can use that to specify the value to be used for arg tag values. Here is an example:

ant -Dargstring="-test -abc file.out" build

In the build script we have the following:

  <java classname="test.Main" fork="yes" >
    <arg value="${argstring}"/>

This will result in the arguments “-test -abc file.out” being passed to the java call in the build script.

written by objects \\ tags: , , , ,

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: , , ,

Dec 09

Set the following system properties

  • ftp.proxyHost
  • ftp.proxyPort

java -Dftp.proxyPort=80

To do the same programatically use the System classess setProperty() method

   System.setProperty("ftp.proxyHost", proxyHostname);
   System.setProperty("ftp.proxyPort", proxyPort);

written by objects \\ tags: , ,