首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jacoco报告失踪

Jacoco报告失踪
EN

Stack Overflow用户
提问于 2019-10-19 18:00:35
回答 1查看 1.6K关注 0票数 3

我正试图在我的项目上创建一个jacoco报告。该项目的版本为java 12,而jacoco plugin的版本为0.8.5。

代码语言:javascript
复制
            <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清洁网站

代码语言:javascript
复制
mvn clean install site

我得到了:

代码语言:javascript
复制
[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执行。

我忘了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-20 13:26:02

我的项目是用java 12版本编写的,我启用了像这样的预览功能。

代码语言:javascript
复制
<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评论

我只是代之以

代码语言:javascript
复制
<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>
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58466551

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档