当我运行声纳时,我的代码覆盖总是为0。我正在用三叶草。下面的条目在pom.xml文件
<properties>
<java.version>11</java.version>
<lombok.release>1.18.20</lombok.release>
<spring-cloud.version>Hoxton.SR11</spring-cloud.version>
<vigilphoenix-transformer-core.version>1.3-SNAPSHOT</vigilphoenix-transformer-core.version>
<clover.version>4.2.0</clover.version>
<sonar.java.coveragePlugin>clover</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.clover.reportPath>targetsitecloverclover.xml</sonar.clover.reportPath>
</properties>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${clover.version}</version>
<configuration>
<includesTestSourceRoots>false</includesTestSourceRoots>
<targetPercentage>0%</targetPercentage>
<debug>true</debug>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>setup</goal>
</goals>
</execution>
<execution>
<id>aggregate</id>
<phase>test</phase>
<goals>
<goal>clover</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<configuration>
<!--cloverDatabase>${project.build.directory}/target/clover/cloverMerge.db</cloverDatabase-->
<generateHtml>false</generateHtml>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
<generateHistorical>false</generateHistorical>
</configuration>
</plugin>
当我运行"mvn clean install"我的clover.xml生成在"targetsitecloverclover.xml">
不知道我该做什么。如果有人能帮忙,那将是更大的帮助。
你要么需要配置默认路径的clover插件,要么在maven中调用sonar,你可以手动添加:
mvn sonar:sonar -Dsonar.clover.reportPath=targetsitecloverclover.xml