我正进入(状态
由于缺少执行数据文件而跳过JaCoCo执行:/scratch/jenkins/workspace/sonar-test/target/jacoco.exec错误
我的pom档案是:
test-coverage org.apache.maven.plugins maven-surefire-plugin ${maven.surefire.plugin.version} true true com.project.test.annotation.QuickTest org.jacoco jacoco-maven-plugin 0.7.1.201405082137 prepare-agent report prepare-package report
我错过了什么?
您需要在surefire插件配置中添加$ {argLine}.例:
<build> <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.1.201405082137</version> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.14.1</version> <configuration> <argLine>${argLine}</argLine> </configuration> </plugin> </plugins> </build>
如果你想要你可以添加其他参数到surefire插件,如下所示:
<argLine>${argLine} -XX:PermSize=128m -XX:MaxPermSize=512m</argLine>
丢失的另一个原因jacoco.exec
可能是项目中没有任何单元测试.
编辑:我想知道,为什么我的答案被否决,因为没有人在评论中留下任何理由.我们在包含3个子项目的项目中有相同的错误消息.其中一个是新的,没有任何测试 - 添加一个虚拟单元测试错误消失了.