ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin" <mgai...@hotmail.com>
Subject Re: Passing command line parameter to ant and reading them from within JUnit
Date Tue, 20 Aug 2002 02:38:29 GMT
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" <jesse@cryptocard.com>
To: "Ant Users List" <user@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
>

Mime
View raw message