问题
Is there a way to pass all ant command-line parameters as properties to a java task ?
For example : ant -Dprop1=value1 -Dprop2=value2 ... -file build.xml myTarget
<target name="myTarget">
<java classname="MyClass">
<sysproperty ... all properties>
</java>
</target>
So the started jvm will have all properties passed from the ant command-line.
Thanks
回答1:
Try this:
<java ...>
<syspropertyset>
<propertyref regex=".*"/>
</syspropertyset>
</java>
来源:https://stackoverflow.com/questions/8659403/ant-passing-all-parameters-to-a-java-task