Azure DevOps Server(TFS 2019) 中的SonarQube掃描任務出現錯誤:AppTest.java can't be indexed twice


SonarQube錯誤描述

將一個Maven示例程序導入到Azure DevOps的待庫中,執行SonarQube掃描過程時, DevOps Server提示下面的錯誤信息:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project hellomaven: File src/test/java/com/mycompany/hellomaven/AppTest.java can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files -> [Help 1]
2019-03-07T07:35:49.7588815Z org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project hellomaven: File src/test/java/com/mycompany/hellomaven/AppTest.java can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
2019-03-07T07:35:49.7589428Z

錯誤導致任務無法繼續執行

解決方案:

在SonarQube的任務中增加屬性配置,如下:

sonar.sources=.

sonar.tests=.

sonar.test.inclusions=**/*Test*/**

sonar.exclusions=**/*Test*/**

image

重新執行任務,,問題消失。


微軟DevOps MVP 張洪君 http://www.cnblogs.com/danzhang

--End--


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM