使用不同的参数执行Maven surefire插件两次
我正试图通过带有两个不同参数的SureFire插件运行我的单元测试。 一个是使用jacoco将测试结果输入SonarQube,另一个是在dynatrace中运行。 我试着把它放在两个不同的执行标签中,但似乎不能正常工作。 请帮我弄清楚我做错了什么? 下面是my pom.xml中的代码片段:使用不同的参数执行Maven surefire插件两次,maven,unit-testing,surefire,Maven,Unit Testing,Surefire,我正试图通过带有两个不同参数的SureFire插件运行我的单元测试。 一个是使用jacoco将测试结果输入SonarQube,另一个是在dynatrace中运行。 我试着把它放在两个不同的执行标签中,但似乎不能正常工作。 请帮我弄清楚我做错了什么? 下面是my pom.xml中的代码片段: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-suref
<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>
org.apache.maven.plugins
maven surefire插件
2.12
${jacoco.ut.arg}
-agentpath:“C:\Program Files\dynaTrace\dynaTrace 6.3\agent\lib64\dtagent.dll”=name=JavaAgent,server=localhost:9998,optionTestRunIdJava=${dtTestrunID}
**/在/**
**/它/**
您需要使用
。考虑下面的例子:
<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>
org.apache.maven.plugins
:
执行:重要的是要记住,插件可能有
多重目标。每个目标可能都有一个单独的配置
甚至将插件的目标绑定到一个完全不同的阶段。
执行配置插件目标的执行
您需要使用
。考虑下面的例子:
<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>
org.apache.maven.plugins
:
执行:重要的是要记住,插件可能有
多重目标。每个目标可能都有一个单独的配置
甚至将插件的目标绑定到一个完全不同的阶段。
执行配置插件目标的执行
你必须使用两次执行。你试过了?努力一点。你表现出了你的努力?不是的,你必须执行两次死刑。你试过了?努力一点。你表现出了你的努力?还没有