I've been looking for a way to pass arguments to ANT, but have so far
been unsuccessful. I figured out how to pass them from the command
line:
ant -buildfile -Dmyarg=abc
... but what I'd like to do, is have an ANT script call a different
ANT script, and pass the arguments along. So far, I have not figured
out how to pass arguments to an ANT script, from within another ANT
script. What I have is something like this:
(Inside build.xml):
<ant dir="${ant.exec.directory}" antfile="${ant.script.name}"
target="main" inheritAll="true"/>
I'd like to pass any arguments to 'ant.script.name' that 'build.xml'
receives. For instance, if there was a 'parameter' attribute, I could
use something like that.
Any suggestions?
Roedy Green - 07 Apr 2008 19:47 GMT
On Mon, 7 Apr 2008 10:05:39 -0700 (PDT), Eric Farraro
<superpeon1@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>... but what I'd like to do, is have an ANT script call a different
>ANT script, and pass the arguments along. So far, I have not figured
>out how to pass arguments to an ANT script, from within another ANT
>script. What I have is something like this:
You can put things in the set environment. I put the jar signing
password in there, for example.
I get at it like this:
<!-- get _your_ password from set jarsignerpassword=sesame -->
<!-- get _your_ code-signing certificate from set
cert=mindprodcert2008dsa -->
<property environment="env" />
<signjar jar="${jar.file}"
alias="${env.cert}" storepass="${env.jarsignerpassword}" />

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Arne Vajhøj - 08 Apr 2008 01:16 GMT
> I've been looking for a way to pass arguments to ANT, but have so far
> been unsuccessful. I figured out how to pass them from the command
[quoted text clipped - 15 lines]
> receives. For instance, if there was a 'parameter' attribute, I could
> use something like that.
inheritAll="true" will pass all existing properties.
To pass new properties use:
<ant dir="${ant.exec.directory}" antfile="${ant.script.name}"
target="main" inheritAll="true">
<property name="myarg" value="abc"/>
</ant>
Arne