Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- what are you trying to achieve
- what have you tried so far to achieve this
I am using sonarQube 9.0.1 community addition.
I want to scan multiple project’s source directory of different language.
I tried to use sonarscanner for java project but it gives below error.
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
Can’t I scan java source files with sonar scanner.
As I want common method for all project scan.
Thanks in advance.
Technically it’s possible but it’s not too easy. Look at the documentation:
Java Analysis and Bytecode
.class files are required for java projects with more than one java file. If not provided properly, analysis will fail with the message:
Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
If you are not using Maven or Gradle for analysis, you must manually provide bytecode to the analysis. You can also analyze test code, and for that you need to provide tests binaries and test libraries properties.
If your project can be build with Maven/Gradle, using the SonarScanner for Maven/Gradle is soooo much easier than setting all properties manually, there’s no practical reason to use the plain SonarScanner.
Seem that you need to build your project prior to run the analysis.
mvn install or
gradle build before.
Thanks Mathieu and Felipe.
I got below things from link “Overview | SonarQube Docs”
" Will all files be analyzed?
.js files would be loaded, but
.cpp files would be ignored."
Is this means Java file here or class file?
If java file then can you please provide me a link or doc which can show me steps for analysing java source code.