2017-01-20 7 views
0

두 개의 다른 인수로 확실한 플러그인을 통해 단위 테스트를 실행하려고합니다. 테스트 결과를 SonarQube에 공급하기 위해 jacoco를 사용하고 다른 하나는 dynatrace에서 실행하는 것입니다. 두 개의 다른 실행 태그에 넣으려고했지만 제대로 작동하지 않습니다. 내가 뭘 잘못하고있는 걸 도와 주시겠습니까?다른 인수로 Maven-surefire-plugin을 두 번 실행하십시오.

<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

두 번 실행해야합니다. 당신은 시도? 더 열심히 노력하십시오. 너 노력을 보여 줬어? 아직 – 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에서보세요
을 플러그인이 여러 목표를 가지고 수 있다는 것을 명심하는 것이 중요하다. 각 목표는 별도의 구성을 가질 수 있습니다. 플러그인의 목표를 다른 단계에 모두 바인딩 할 수도 있습니다. 실행은 플러그인의 목표 실행을 구성합니다.