Ant と Maven を使用してプロジェクトを構築しようとしています。テストユニットにtestNGを使用しています。ここで述べたように ( http://testng.org/doc/ant.html )、次のように taskdef を定義しました。
<taskdef resource="testngtasks" classpath="testng.jar"/>
アリで。
Mavenでは、次を追加しました(ここに記載されているように:http://testng.org/doc/maven.html)
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.2</version>
</dependency>
Maven は maven リポジトリからファイルを取得しており、/.m2 の下の場所を確認しました。Maven から testNG を取得したので、Ant の taskdef を変更して、Maven リポジトリでこの新しいものを使用する必要があります。その方法がわかりません。私は次のことを試しました:
<taskdef resource ="testngtasks" classname="org.testng" />
と
<taskdef resource ="testngtasks" classname="org.testng" classpathref="maven.compile.classpath"/>
と
<taskdef resource ="testngtasks" />
しかし成功しませんでした.2番目はclasspathrefを使用すべきではないと不平を言い、最初のものはクラスを指定する必要があると言っています. 3番目のものは、ある程度機能していますが、完全ではありません。それは順調に進んでおり、タスク定義ステップに合格すると思いますが、テストを実行していません。Ant の一部 (3 つ目):
<taskdef resource="testngtasks" />
<target name="test" depends="compile">
<echo message="running tests" />
Ant 出力の一部: (echo が実行されたことに注意してください。何らかの方法で taskdef ステップが渡されます)
compile:
[javac] /home/shahin/Files/Development/Ant/ServiceEJBSample3/build-testNG.xml:31: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
test:
[echo] running tests
BUILD FAILED
/home/shahin/Files/Development/Ant/ServiceEJBSample3/build-testNG.xml:84: Problem: failed to create task or type testng
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Ant で testngtasks を定義 ( taskdef ) するために、Maven リポジトリで testNG ライブラリを使用する方法がわかりません。どんな洞察も高く評価されます