You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by dave young <dy...@bsis.com.au> on 2001/06/25 12:36:29 UTC
obtaining arguments from the ant command line [newbie]
hi,
i would really like to be able to pass down command line arguments (that
have been specified to ant on the command line) to some of my tasks
(well, java classes in my tasks). i have scoured the on-line docs and
have not managed to uncover a means of accomplishing this.
is this just a no-go area in ant, or does anybody know of a way of
uncovering the values of command line arguments specified to ant??
the reason for me wanting to do this is as follows;
i have a class, which given a class or resource, will output where
abouts that resource was loaded, this can really help out when
diagnosing java code.
i have a common classpath which i use throughout my project.
i would like to make a "find" task within my build.xml file which reads
a resource/class name from the command line (ie: the next argument after
the "find" task name) and submits that string to my finding class, using
the same classpath as my building and testing tasks.
hope somebody can either let me know how to do this or point out why i
am going about this completely the wrong way. i've been using makefiles
quite happily for donkeys years and do want to give this ant thing a go.
regards,
dave young.
Re: obtaining arguments from the ant command line [newbie]
Posted by Rob van Oostrum <rv...@ezgov.com>.
you pass params to ant from the commanline like this:
java -Dyour.param.name=YourParamValue org.apache.tools.ant.Main
in your build.xml, you can reference this by simply doing ${your.param.name}
This is what they do in Ant's own build.xml so I'm assuming it works =)
good luck
Rob
dave young wrote:
> hi,
>
> i would really like to be able to pass down command line arguments (that
> have been specified to ant on the command line) to some of my tasks
> (well, java classes in my tasks). i have scoured the on-line docs and
> have not managed to uncover a means of accomplishing this.
>
> is this just a no-go area in ant, or does anybody know of a way of
> uncovering the values of command line arguments specified to ant??
>
> the reason for me wanting to do this is as follows;
> i have a class, which given a class or resource, will output where
> abouts that resource was loaded, this can really help out when
> diagnosing java code.
> i have a common classpath which i use throughout my project.
> i would like to make a "find" task within my build.xml file which reads
> a resource/class name from the command line (ie: the next argument after
> the "find" task name) and submits that string to my finding class, using
> the same classpath as my building and testing tasks.
>
> hope somebody can either let me know how to do this or point out why i
> am going about this completely the wrong way. i've been using makefiles
> quite happily for donkeys years and do want to give this ant thing a go.
>
> regards,
>
> dave young.
Re: obtaining arguments from the ant command line [newbie]
Posted by Diane Holt <ho...@yahoo.com>.
--- dave young <dy...@bsis.com.au> wrote:
> i would really like to be able to pass down command line arguments (that
> have been specified to ant on the command line) to some of my tasks
> (well, java classes in my tasks). i have scoured the on-line docs and
> have not managed to uncover a means of accomplishing this.
It's in the section "Running Ant" in the user manual.
Diane
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/