Ant中java任务应用命令行传参数
Ant中java任务使用命令行传参数
archive.cnblogs.com/a/2111880/
目前需要使用ant来执行一个含有main方法的class文件,并且需要通过命令来行传两个参数(start和end)到main方法。 <target name="gsp" depends="compile" description="generator structure pictures"> <echo message="----------- Generator structure pictures ------------" /> <property name="start" value="1" /> <property name="end" value="892046" /> <java fork="true" classname="com.founder.cst.system.StructureImageGenerator"> <arg value="${start}"/> <arg value="${end}"/> <classpath path="${build.dir}/classes"/> <classpath refid="classpath" /> </java> <echo message="----------- End------------" /> </target> 这样执行ant gsp -Dstart=10 -Dend=20 就可以把10和20传到main方法中了,最好设置默认值。
archive.cnblogs.com/a/2111880/