sonar maven 程式碼覆蓋率
阿新 • • 發佈:2019-02-13
執行命令:
mvn -s D:\software\.m2\settings.xml test sonar:sonar
<plugin.jacoco.version>0.7.6.201602180812</plugin.jacoco.version>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId >jacoco-maven-plugin</artifactId>
<version>${plugin.jacoco.version}</version>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
</configuration>
<executions>
<execution>
<id>agent</id >
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
在pom.xml中加入相關profile
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault >true</activeByDefault>
</activation>
<properties>
<sonar.host.url>http://172.31.20.46:9000</sonar.host.url>
</properties>
</profile>
</profiles>