只想知道使用maven插件启动jacoco代理是否有用,并为surefire添加一些参数?它会启动Jacoco两次吗?
示例:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>和
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-javaagent:${sonar.jacoco.jar}=destfile='${sonar.jacoco.reportPath}'</argLine>发布于 2012-06-05 17:31:49
他们提供了Maven usage example,所以似乎不需要额外的参数来保证。
发布于 2012-06-05 21:30:59
我不知道你的${jacoco.version}是什么,但是下面的代码片段对我很有效。
你不需要为surefire插件提供额外的参数。
版本必须是在Maven Repository中声明的版本(假设您没有在本地安装依赖项或使用其他/自定义存储库):
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.7.201204190339</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>https://stackoverflow.com/questions/10894672
复制相似问题