RedHood148
RedHood148

Reputation: 449

Error while scanning a project with Sonar Scanner

I have been trying to scan a java project (ArgoUML) with the sonar scanner and I'm getting the following error when using sonar-scanner in the project directory:

ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries property

The project is cloned from this repo: https://github.com/cscorley/argouml-mirror

I tried building with maven using mvn package and mvn install but every time I'm getting an error. The last error that I got is:

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.

Any suggestions how I can fix this? Let me know if you need more info.

Thanks.

Upvotes: 0

Views: 940

Answers (2)

Diasiare
Diasiare

Reputation: 755

You have unit tests in argouml-app that are failing. You can either fix the code or the tests so that they pass. Or you can just skip the tests by running mvn install -DskipTests when building the project. This will allow you to build the project and produce the binaries that Sonar needs.

Upvotes: 2

Ankur
Ankur

Reputation: 922

I do not exactly know the reason for this, but can help you with the solution that worked for me.

You must have mentioned the source path under "sonar.sources" in your configuration specifying the source package from where code needs to be scanned. eg. sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src

along with this property, set another property under "sonar.java.binaries" and provide same value as "sonar.sources".

So it would look something like this:

sonar.sources=/home/workspace/codecoveragejob/Test_project/Test_project_service/src

sonar.java.binaries= /home/workspace/codecoveragejob/Test_project/Test_project_service/src

Hope that helps...

Upvotes: 2

Related Questions