我在下面添加了pom.xml文件。构建成功完成并执行了测试用例,但覆盖率仅显示0%。
我在配置中缺少什么?当我通过inteliji执行相同操作时,它可以生成覆盖率,但是使用mvn命令显示覆盖率为0%。
mvn verify --update-snapshots org.jacoco:jacoco-maven-plugin:prepare-agent install -DskipITs=true
<shnArgLine>-XX:-UseSplitVerifier -Xmx1024m -XX:MaxPermSize=512m</shnArgLine>
<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.language>java</sonar.language>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<profiles>
<profile>
<id>sonar-coverage</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<append>true</append>
<excludes>
<exclude>**/*Config.*</exclude>
<exclude>**/*Constants.*</exclude>
<exclude>**/*Enum.*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>agent-for-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>agent-for-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>