gpt4 book ai didi

java - 艾玛代码覆盖率,在源路径中找不到源文件

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:56:52 25 4
gpt4 key购买 nike

为了生成 emma 报告,我运行了这些命令。

  1. mvn install -Pwith-emma 
2. java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -in coverage.ec -in target/coverage.em

运行命令后,我可以生成 emma 报告,也可以根据需要排除包,它会给我整个类(class)的覆盖率报告。但问题是当我点击任何特定的类来查看文件报告(代码覆盖率)时,我得到:

[在源路径中找不到源文件 'com/test/test.java']当我生成艾玛报告时。

这是我关于 emma-maven-plugin 的 pom.xml 条目<

 <profile>
<id>with-emma</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>instrument</id>
<phase>process-test-classes</phase>
<configuration>
<filters>
<filter>-com.test.generated.ceq.*</filter>
<filter>-com.activities.*</filter>
</filters>
</configuration>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

检查了很多链接后我觉得命令有问题

 2.  java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -in coverage.ec -in target/coverage.em

但是尝试了很多都无法解决这个问题。谢谢。

最佳答案

据我所知,您应该在“emma report”命令行中添加 -sp 标志以在报告中包含来源:

java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -sp /<path-to-project>/src/main/java/ -sp /<path-to-another-project>/src/main/java/ -in coverage.ec -in target/coverage.em

关于java - 艾玛代码覆盖率,在源路径中找不到源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22658418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com