我使用ANT在build.xml下运行。
<?xml version="1.0" ?>
<project name="EITaaS_Testing" default="runtests">
<path id="compile.classpath">
<fileset dir="TEST_LIB">
<include name="*.jar"/>
</fileset>
</path>
<path id="run.tests">
<fileset dir="TEST_LIB">
<include name="*.jar"/>
</fileset>
<fileset dir="dist">
<include name="*"/>
</fileset>
</path>
<target name="clean">
<delete dir="dist" />
<delete dir="build" />
<delete dir="test-output" />
<delete file="test-output.zip" />
<delete dir="log" />
</target>
<target name="init" depends="clean">
<mkdir dir="build/classes"/>
<mkdir dir="dist" />
<mkdir dir="test-output" />
<mkdir dir="log" />
</target>
<target name="compile" depends="init" >
<javac destdir="build/classes" debug="true" srcdir="src">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="build-jar" depends="compile">
<jar destfile="dist/test-jar.jar" basedir="build/classes">
</jar>
</target>
<target name="runtests" depends="build-jar" >
<java classname="org.testng.TestNG">
<arg value="src/PortalTestcases_testng.xml"/>
<classpath refid="run.tests"/>
</java>
</target>
<target name="zip">
<echo>Creating zip file...</echo>
<zip destfile="test-output.zip" basedir="test-output"/>
<echo>Done!</echo>
</target>
</project>
我的要求是压缩成功运行后创建的test-output文件夹。当我执行命令&#34; ant zip&#39;只有它创建zip文件没有任何问题。但是当我从eclipse或使用ant -y build.xml执行整个build.xml时,就不会创建zip文件。不知怎的,它忽略了zip命令。我尝试在build.xml中更改zip的顺序,但仍然没有运气。