ant 编译文件出错解决方案
ant 编译文件出错
<project name="sample" default="test" basedir=".">
<property name="src" location="src" />
<property name="classpath" location="build" />
<property name="lib" location="lib" />
<property name="dist" location="dist" />
<property name="dist.dir" location="${basedir}/../anttest/src" />
<property name="lib.dir" value="${basedir}/../anttest/lib" description="The lib directory for 3rd party libs"/>
<!-- COMPILE TESTS-->
<mkdir dir="${lib}"/>
<copy todir="${lib}" >
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<mkdir dir="${dist}"/>
<copy todir="${src}" >
<fileset dir="${dist.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<path id="cpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile">
<echo message="compiling tests"/>
<mkdir dir="classes"/>
<javac debug="true"
source="1.7" classpathref="cpath"
srcdir="src" destdir="classes"/>
</target>
<!-- RUN TESTS-->
<taskdef name="testng"
classname="com.beust.testng.TestNGAntTask"
classpathref="cpath"/>
<path id="runpath">
<path refid="cpath"/>
<pathelement location="classes"/>
</path>
<target name="test" depends="compile">
<echo message="running tests"/>
<testng fork="yes" classpathref="runpath" outputDir="test-output">
<fileset dir="src" includes="testng.xml"/>
<jvmarg value="-ea" />
</testng>
</target>
</project>
我的配置文件如上。但编译的时候出现引用外部的一些jar包引用不到。
哪位大侠帮忙修改一下哈。
------解决思路----------------------
已经解决掉了
<project name="sample" default="test" basedir=".">
<property name="src" location="src" />
<property name="classpath" location="build" />
<property name="lib" location="lib" />
<property name="dist" location="dist" />
<property name="dist.dir" location="${basedir}/../anttest/src" />
<property name="lib.dir" value="${basedir}/../anttest/lib" description="The lib directory for 3rd party libs"/>
<!-- COMPILE TESTS-->
<mkdir dir="${lib}"/>
<copy todir="${lib}" >
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<mkdir dir="${dist}"/>
<copy todir="${src}" >
<fileset dir="${dist.dir}">
<include name="**/*.java"/>
</fileset>
</copy>
<path id="cpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile">
<echo message="compiling tests"/>
<mkdir dir="classes"/>
<javac debug="true"
source="1.7" classpathref="cpath"
srcdir="src" destdir="classes"/>
</target>
<!-- RUN TESTS-->
<taskdef name="testng"
classname="com.beust.testng.TestNGAntTask"
classpathref="cpath"/>
<path id="runpath">
<path refid="cpath"/>
<pathelement location="classes"/>
</path>
<target name="test" depends="compile">
<echo message="running tests"/>
<testng fork="yes" classpathref="runpath" outputDir="test-output">
<fileset dir="src" includes="testng.xml"/>
<jvmarg value="-ea" />
</testng>
</target>
</project>
我的配置文件如上。但编译的时候出现引用外部的一些jar包引用不到。
哪位大侠帮忙修改一下哈。
------解决思路----------------------
已经解决掉了