D
David Portabella
HEllo,
You can pass parameters from the command line to your ant build file
by using properties.
Using ant -Dname=value lets you define values for properties on the
Ant command line.
These properties can then be used within your build file as any normal
property: ${name} will put in value.
However,
Let's say that I have the following java program:
++++++++++++++
class Test {
public static void main(String argv[]) {
for (int i = 0; i < argv.lenght;i++)
System.out.println("param " + i + ": " + argv);
}
}
++++++++++++++
and I have the following ant file:
++++++++++++++
<project basedir=".">
<target name="run">
<java fork="true" classname="Test"/>
</target>
</project>
++++++++++++++
How do I need to modify the ant file so that executing "ant run one
two three" from the command line, produces:
++++++++++++++
param 1: one
param 2: two
param 3: three
++++++++++++++
(and it works for any number of parameters)
Many thanks,
DAvid
You can pass parameters from the command line to your ant build file
by using properties.
Using ant -Dname=value lets you define values for properties on the
Ant command line.
These properties can then be used within your build file as any normal
property: ${name} will put in value.
However,
Let's say that I have the following java program:
++++++++++++++
class Test {
public static void main(String argv[]) {
for (int i = 0; i < argv.lenght;i++)
System.out.println("param " + i + ": " + argv);
}
}
++++++++++++++
and I have the following ant file:
++++++++++++++
<project basedir=".">
<target name="run">
<java fork="true" classname="Test"/>
</target>
</project>
++++++++++++++
How do I need to modify the ant file so that executing "ant run one
two three" from the command line, produces:
++++++++++++++
param 1: one
param 2: two
param 3: three
++++++++++++++
(and it works for any number of parameters)
Many thanks,
DAvid