ant passing all parameters to a java task

牧云@^-^@ 提交于 2019-12-22 18:06:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!