[英]How can I exclude files of the Code Coverage of SonarQube using JaCoCo maven plugin
[英]How to exclude files for sonar coverage using terminal command for running sonarqube?
我正在為應該支持多個國家特定更改的應用程序編寫通用代碼,例如巴西和法國。
巴西有一些 Java 類,法國不需要。 因此,為了運行 sonarqube,我需要排除這些文件以進行聲納覆蓋。 另外,我需要排除 dtos、util 類。
我們通常使用標記排除 pom 文件中的類的覆蓋范圍。 但我需要使用 mvn clean install 命令排除文件。
傳統方法:
但我想排除終端中的java類,如下所示:
C:\Projects\web-application>mvn clean install -Dspring.profiles.active=dev -Dspring.profiles.country=brazil -Dsonar.coverage.exclusions=**/pom.xml,**/domain/dtos/**/*,**/domain/models/**/*,**/services/someClass.java
Sonarqube 運行但無法排除文件。
我假設您正在使用您的參數:
-Dsonar.coverage.exclusions=**/pom.xml,**/domain/dtos/**/*,**/domain/models/**/*,**/services/someClass.java
您正在混合可能導致問題的路徑和文件排除項,如 Sonar Dev 所述 - https://community.sonarsource.com/t/sonar-coverage-exclusions-not- exclude-too-much/31276/4
這應該有效:
-Dsonar.coverage.exclusions=**/pom.xml,**/domain/dtos/**/*.*,**/domain/models/**/*.*,**/services/someClass.java
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.