ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Stockall <>
Subject Re: Passing command line parameter to ant and reading them from within JUnit
Date Thu, 13 Feb 2003 00:45:25 GMT
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?


If you run Ant like this:

ant -Dmyprop1=value1 -Dmyprop2=value2

Define your junit target like this:

	<sysproperty key="prop1" value="${myprop1}"/>
	<sysproperty key="prop2" value="${myprop2}"/>

Then in your testcases you can do System.getProperty("prop1");

Jesse Stockall -
CRYPTOCard Corp.

View raw message