我正试图在我的项目上创建一个jacoco报告。该项目的版本为java 12,而jacoco plugin的版本为0.8.5。
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>我推出了一个mvn清洁网站
mvn clean install site我得到了:
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (pre-unit-test) @ bowling-game ---
[INFO] argLine set to -javaagent:/home/baptiste/.m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/home/baptiste/IdeaProjects/Bowling-Game/target/jacoco.exec
...
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ bowling-game ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.keywer.kata.bowling.game.frame.state.FrameStateTest
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 s - in com.keywer.kata.bowling.game.frame.state.FrameStateTest
[INFO] Running com.keywer.kata.bowling.game.BowlingGameTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in com.keywer.kata.bowling.game.BowlingGameTest
...
[INFO] --- jacoco-maven-plugin:0.8.5:report (post-unit-test) @ bowling-game ---
[INFO] Skipping JaCoCo execution due to missing execution data file.我正在寻找该报告,但实际上它没有创建,原因如下:
信息由于缺少执行数据文件而跳过JaCoCo执行。
我忘了什么?
发布于 2019-10-20 13:26:02
我的项目是用java 12版本编写的,我启用了像这样的预览功能。
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>--enable-preview</argLine> <=== This line
</configuration>
</plugin>问题是maven无法生成jacoco.exec。
感谢@Jacek,我找到了https://stackoverflow.com/a/23605812/8591625评论
我只是代之以
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>${argLine} --enable-preview</argLine> <=== Here I adding ${argLine} in order to not override argument
</configuration>
</plugin>https://stackoverflow.com/questions/58466551
复制相似问题