Bezdepbonusu7Программирование: статьи и ответы

Вопрос

Сборка Ant TestNG работает в Eclipse, но не с терминала

Автор вопроса: ArmandoОтветов: 1

Я могу запустить сборку Ant из Eclipse, щелкнув правой кнопкой мыши и выбрав Ant Build.

Когда я пытаюсь выполнить ту же сборку, запустив Ant из cmd, я получаю результат "Сборка прошла успешно", но ничего не создается.

Файл сборки.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>

And the Testng.xml

<suite name="Regression Test Suite">

  <test name="My Test">

  <classes>

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

  </classes>

  </test>

</suite>

eclipseseleniumtestngant

Ответы

Ответ 1 · рейтинг 1 · Armando

Я определил проблему. Я не указал цель по умолчанию в настройках моего проекта. Eclipse IDE удалось скомпилировать, но в терминале я использовал только ANT и не указывал, какую цель собирать. Итак, он успешно "строился", потому что я не говорил ему, что строить.

Перевод вопроса и ответов сообщества Stack Overflow, лицензия CC BY-SA. Оригинал на Stack Overflow.

Похожие материалы