<target name="init" description = "create classes file">
<!--mkdir means : create file:classes-->
<mkdir dir="${dest}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${dest}" classpathref="compile.path" encoding="UTF-8"/>
</target>
<!--run testng ant task-->
<taskdef resource="testngtasks" classpath="${lib.dir}/testng-6.4.jar" />
<target name="start_server_and_run_tests" depends="compile" description="start selenium server and run tests">
<parallel>
<antcall target="run_tests">
</antcall>
</parallel>
</target>
<target name="run_tests" depends="compile">
<testng classpathref="compile.path" failureproperty="test.failed">
<!--xml test suite file -->
<xmlfileset dir="${basedir}">
<include name="testng.xml" />
</xmlfileset>
</testng>
<antcall target="sendReport" />
<fail message="ERROR: test failed!!!!!" if="test.failed" />
</target>
<target name="sendReport">
<delete dir="${dest}"/>
<antcall target="transform" />
</target>
<target name="transform">
<xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/test-output/testng-results.xsl" out="${basedir}/test-output/index1.html" classpathref="compile.path">
<!-- you need to specify the directory here again -->
<param name="testNgXslt.outputDir" expression="${basedir}/test-output/" />
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
<!--<classpath refid="compile.path" />-->
</xslt>
</target>
</project>
这样我的整个环境搭成了,写代码及调试用了将近一周,而配置实际上只用了一个上午;
希望你也能成功;从此不用打开idea直接用jenkins可以搞定了。