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*/**
重新執行任務,,問題消失。
微軟DevOps MVP 張洪君 http://www.cnblogs.com/danzhang
--End--