Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AntTestNG构建可以在Eclipse中工作,但不能从终端运行_Eclipse_Ant_Selenium_Testng - Fatal编程技术网

AntTestNG构建可以在Eclipse中工作,但不能从终端运行

AntTestNG构建可以在Eclipse中工作,但不能从终端运行,eclipse,ant,selenium,testng,Eclipse,Ant,Selenium,Testng,通过右键单击并选择Ant build,我可以从Eclipse运行Ant构建 当我试图通过从cmd运行Ant来执行相同的构建时,我得到的结果是“构建成功”,但没有构建任何内容 Build.xml文件 <property name ="build.dir" value="${basedir}/build"/> <property name="lib.dir" value="${basedir}/lib"/> <property name="src.dir" value=

通过右键单击并选择Ant build,我可以从Eclipse运行Ant构建

当我试图通过从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>


我确定了问题所在。我没有在项目设置中指明默认目标。EclipseIDE能够编译,但在终端中,我只使用了ANT,没有指明要构建哪个目标。所以它是“建造”成功的,因为我没有告诉它建造什么

我决定了这个问题。我没有在项目设置中指明默认目标。EclipseIDE能够编译,但在终端中,我只使用了ANT,没有指明要构建哪个目标。所以它是“建造”成功的,因为我没有告诉它建造什么

你好,阿曼多,我知道这是很久以前的事了,但是你还记得你在哪里指的吗?你好,阿曼多,我知道这是很久以前的事了,但是你还记得你在哪里指的吗?