2011-07-15 74 views
1

我能夠通過右鍵單擊並選擇Ant Build來從Eclipse運行Ant構建。Ant TestNG構建在Eclipse中工作,但不是從終端

當我嘗試通過從cmd運行Ant來執行相同的構建時,我得到的結果是「構建成功」,但沒有構建任何內容。

build.xml文件

<property name ="build.dir" value="${basedir}/build"/> 
<property name="lib.dir" value="${basedir}/lib"/> 
<property name="src.dir" value="${basedir}/src"/> 
<property name="name" value="value"/> 

<target name="setClassPath"> 
    <path id="classpath_jars"> 
     <path id="${basedir}/"/> 
     <fileset dir="${lib.dir}" includes="*.jar"/> 
    </path> 
<pathconvert pathsep=":" property="test.classpath" refid="classpath_jars"/> 
</target> 

<target name="loadTestNG" depends="setClassPath"> 
    <taskdef resource="testngtasks" classpath="${test.classpath}"/> 
</target> 

<target name="init"> 
    <mkdir dir="${build.dir}"/> 
</target> 

<target name="clean"> 
    <echo message="deleting existing build directory"/> 
    <delete dir="${build.dir}"/> 
</target> 

<target name="compile" depends="clean, init, setClassPath, loadTestNG"> 
    <echo message="classpath: ${test.classpath}"/> 
    <echo message="compiling..."/> 
    <javac destdir="${build.dir}" srcdir="${src.dir}" classpath="${test.classpath}"   encoding="cp1252"/> 
</target> 

<target name="run" depends="compile"> 
    <testng classpath ="${test.classpath}:${build.dir}"> 
    <xmlfileset dir="${basedir}" includes="testng.xml"/> 
    </testng> 

</target> 

</project> 

而且testng.xml文件

<suite name="Regression Test Suite"> 

    <test name="My Test"> 

    <classes> 

    <class name="com.RegressionTest.Sometest"/> 

    </classes> 

    </test> 

</suite> 

回答

1

我決定的問題。我沒有在我的項目設置中指出默認目標。 Eclipse IDE能夠編譯,但在終端中,我只使用了ANT,並沒有指出要構建哪個目標。所以這是「成功」的成功,因爲我沒有告訴它要構建什麼。

+0

嗨阿曼多,我知道這是前一陣子,但你還記得你指出這一點嗎? – Kristin

相關問題