开发者

Ant TestNG build works in Eclipse but not from terminal

开发者 https://www.devze.com 2023-03-21 01:30 出处:网络
I\'m able to run an Ant build from Eclipse by right clicking and selecting Ant Build. When I attempt to execute the same build by running Ant from cmd I get results that the \"Build Was Successful\"

I'm able to run an Ant build from Eclipse by right clicking and selecting Ant Build.

When I attempt to execute the same build by running Ant from cmd I get results that the "Build Was Successful" but nothing is built.

Build.xml file

<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="${bui开发者_JAVA百科ld.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>

And the Testng.xml

<suite name="Regression Test Suite">

  <test name="My Test">

  <classes>

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

  </classes>

  </test>

</suite>


I determined the issue. I did not indicate the default target in my Project set up. Eclipse IDE was able to compile but in the terminal I was only using ANT and not indicating which target to build. So it was "building" successfully because I did not tell it what to build.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号