You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Martin <mg...@hotmail.com> on 2002/08/20 04:38:29 UTC

Re: Passing command line parameter to ant and reading them from within JUnit

Yep-
Or you could set up the environment variable to the property value e.g.
ANT_HOME
then have Ant set the property to env var ${env.ANT_HOME}
-(negates having to set all the properties on the command line).
Regards,
Martin
----- Original Message -----
From: "Jesse Stockall" <je...@cryptocard.com>
To: "Ant Users List" <us...@ant.apache.org>
Sent: Wednesday, February 12, 2003 8:45 PM
Subject: Re: Passing command line parameter to ant and reading them from
within JUnit


> On Wednesday, February 12, 2003, at 07:31 PM, Tony Obermeit wrote:
> > I would like to reference the property values passed
> > on the command line to ant within Junit java code.  Is
> > this possible?
>
> Yes.
>
> If you run Ant like this:
>
> ant -Dmyprop1=value1 -Dmyprop2=value2
>
> Define your junit target like this:
>
> <junit
> printsummary="yes"
> dir="${classes.dir}">
> <sysproperty key="prop1" value="${myprop1}"/>
> <sysproperty key="prop2" value="${myprop2}"/>
> </junit>
>
> Then in your testcases you can do System.getProperty("prop1");
>
> Jesse Stockall - jesse@cryptocard.com
> CRYPTOCard Corp.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>