执行ANT JAVA三种方式

时间:2022-03-14 20:12:31

1、 命令行

<target name="reporttoexcel" depends="report">

<exec executable="cmd" failonerror="true">

<arg value = "/c"/>

<arg value = "java"/>

<arg value = "-jar"/>

<arg value = "converttoexcel.jar"/>

<arg value = "${languagename.reportxml.dir}"/>

</exec>

</target>

2、 主类

<target name="main">

<java classname="com.test.distribute.Distribute" classpathref="lib_classpath">

<arg value="123"/>

</java>

</target>

3、 执行JAR包

<java jar="dist/test.jar" fork="true" failonerror="true" maxmemory="128m"  >

<arg value="arg1"/>

<arg value="arg2"/>

<arg value="arg3"/>

<classpath>

<pathelement location="dist/test.jar"/>

</classpath>

</java>