Ant构建错误:SRC不存在
问题描述:
我试图通过Ant工具,但总是控制台输出运行我的生成显示了这个错误:Ant构建错误:SRC不存在
**E:\Automation\PowerElectronicsWorkShop\FreesunPortal\build.xml:31: srcdir "E:\Automation\PowerElectronicsWorkShop\FreesunPortal\${src.dir}" does not exist!
在build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="" basedir="." default="runTests">
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="E:\Automation\Jar files\Jars"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="ng.result" value="test-output" />
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<target name="setClassPath">
<path id="classpath_jars">
<fileset dir="E:\Automation\Jar files">
<include name="*.jar" />
</fileset>
<pathelement path="${class.path}" />
</path>
<pathconvert pathsep=":" property="test.classpath" refid="classpath_jars" />
</target>
<target name="clean" depends="setClassPath">
<echo message="deleting existing build directory"/>
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="clean">
<echo message="compiling.........."/>
<javac destdir="${build.dir}" debug="true" srcdir="${src.dir}" classpath="${test.classpath}"/>
</target>
<target name="runTests" depends="compile">
<taskdef resource="testngtasks" classpath="${test.classpath}"/>
<testng classpath="${test.classpath}:${build.dir}">
<xmlfileset dir="${basedir}" includes="testng.xml"/>
</testng>
</target>
</project>
我不了解每次发生这种情况的原因。
答
增加下面下属性标记
<property name="src.dir" location="src" />
<property name="build.dir" location="bin" />
代码现在你可以重新建立你的代码通过ANT
,它会工作。
该目录是否存在? – Ben 2014-12-08 06:17:37
您没有在代码中设置/设置“build.dir”和“src.dir”属性 – 2014-12-08 13:00:30