我一直在尝试使用声纳扫描器扫描java项目(ArgoUML),并且在项目目录中使用sonar-scanner
时出现以下错误:
ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries property
该项目是从这个回购克隆的: https://github.com/cscorley/argouml-mirror
我尝试使用mvn package
和mvn install
使用maven进行构建,但每次出现错误时都是如此。我得到的最后一个错误是:
Results :
Failed tests:
Tests in error:
Tests run: 1106, Failures: 2, Errors: 8, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] argouml-core 0.35.2-SNAPSHOT ....................... SUCCESS [ 0.898 s]
[INFO] argouml-core-model ................................. SUCCESS [ 0.783 s]
[INFO] argouml-core-model-mdr ............................. SUCCESS [ 8.167 s]
[INFO] argouml-core-model-euml ............................ SUCCESS [ 0.162 s]
[INFO] argouml-app ........................................ FAILURE [04:55 min]
[INFO] argouml-core-notation .............................. SKIPPED
[INFO] argouml-core-transformer ........................... SKIPPED
[INFO] argouml-core-umlpropertypanels ..................... SKIPPED
[INFO] argouml-core-diagrams-activity2 .................... SKIPPED
[INFO] argouml-core-diagrams-class2 ....................... SKIPPED
[INFO] argouml-core-diagrams-sequence2 .................... SKIPPED
[INFO] argouml-core-diagrams-state2 ....................... SKIPPED
[INFO] argouml-core-diagrams-structure2 0.35.2-SNAPSHOT ... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:05 min
[INFO] Finished at: 2018-05-03T12:07:31+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8.1:test (default-test) on project argouml: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/redhood148/Documents/git/argouml-mirror/src/argouml-app/target/surefire-reports for the individual test results.
有什么建议我可以解决这个问题吗? 如果您需要更多信息,请告诉我。
感谢。
答案 0 :(得分:2)
我不知道原因,但可以帮助您找到适合我的解决方案。
您必须在配置中提到“sonar.sources”下的源路径,指定需要扫描代码的源包。
例如。 sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src
与此属性一起,在“sonar.java.binaries”下设置另一个属性,并提供与“sonar.sources”相同的值。
所以它看起来像这样:
sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src
sonar.java.binaries= /home/workspace/codecoveragejob/Test_project/Test_project_service/src
希望有帮助...
答案 1 :(得分:2)
您在argouml-app
中的单元测试失败了。您可以修复代码或测试以便它们通过。或者,您可以在构建项目时运行mvn install -DskipTests
来跳过测试。这将允许您构建项目并生成Sonar所需的二进制文件。