2017-01-20 11 views
0

私は単体テストを2つの異なる引数を使って確実に実行するようにしています。 テスト結果をSonarQubeに供給するためにjacocoを使用するものと、dynatraceで実行するものがあります。 2つの異なる実行タグに入れてみましたが、正しく動作していないようです。 私が間違っていることを教えてください。異なる引数でMaven-surefire-pluginを2回実行する

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.12</version> 
    <configuration> 
    <argLine>${jacoco.ut.arg}</argLine> 
    <argLine>-agentpath:"C:\Program Files\dynaTrace\Dynatrace 6.3\agent\lib64\dtagent.dll"=name=JavaAgent,server=localhost:9998,optionTestRunIdJava=${dtTestrunID}</argLine> 
    <excludes> 
     <exclude>**/at/**</exclude> 
     <exclude>**/it/**</exclude> 
    </excludes> 
    </configuration> 
</plugin> 
+0

2回の実行が必要です。あなたがしようとした?強くお試しください。あなたはあなたの努力を示しましたか?未だに – michaldo

答えて

3

<executions/>を使用するためにあなたが必要: は、以下の私のpom.xmlからの抜粋です。次の例を考えてみましょう:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.12</version> 

    <!-- You could also have the configuration tag inside the execution --> 
    <configuration> 
     <argLine>${jacoco.ut.arg}</argLine> 
     <argLine>-agentpath:"C:\Program Files\dynaTrace\Dynatrace 6.3\agent\lib64\dtagent.dll"=name=JavaAgent,server=localhost:9998,optionTestRunIdJava=${dtTestrunID}</argLine> 
     <excludes> 
      <exclude>**/at/**</exclude> 
      <exclude>**/it/**</exclude> 
     </excludes> 
    </configuration> 

    <executions> 
     <execution> 
      <id>run-tests</id> 
      <phase>test</phase> <!-- or whatever phase you like --> 
      ... 
     </execution> 
     <execution> 
      <id>run-jacoco</id> 
      <phase>test</phase> <!-- or whatever phase you like --> 
      <goals>...</goals> 
      ... 
     </execution> 
    </executions> 
</plugin> 

Maven POM Referenceを見てください:

処刑:プラグインが 複数の目標を持っていることを心に留めておくことが重要です。それぞれのゴールは個別の設定を持つことができ、 プラグインのゴールを別のフェーズに完全にバインドすることさえできます。 実行は、プラグインの目標の実行を設定します。

関連する問題