Error when running C++ jenkins pipeline on SonarQube

It is my first time using sonarqube. I am using 7.9.4 version with the community cxx plugin.

I tried in a super simple project and it worked so I went for a bigger project but I keep getting this error everytime I try to build my pipeline. it says that my project contain java files but it does not 00:01:34.600 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. 00:01:34.600 at org.sonar.java.JavaClasspath.init(JavaClasspath.java:64) 00:01:34.600 at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280), what could cause this?. Here is the full log

00:01:32.919  12:52:42.459 INFO: 52529 files indexed
00:01:32.919  12:52:42.460 INFO: Quality profile for c++: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for cs: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for css: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for java: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for js: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for php: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for py: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for web: Sonar way
00:01:32.919  12:52:42.460 INFO: Quality profile for xml: Sonar way
00:01:32.919  12:52:42.460 INFO: ------------- Run sensors on module Boston
00:01:33.497  12:52:42.865 INFO: Load metrics repository
00:01:33.497  12:52:42.877 DEBUG: GET 200 http://localhost:9000/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=12ms
00:01:33.497  12:52:42.885 INFO: Load metrics repository (done) | time=20ms
00:01:34.069  12:52:43.630 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
00:01:34.069  12:52:43.630 DEBUG: 'C++ (Community) RatsSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.630 DEBUG: 'C++ (Community) CppCheckSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.631 DEBUG: 'C++ (Community) PCLintSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.631 DEBUG: 'C++ (Community) DrMemorySensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.631 DEBUG: 'C++ (Community) CxxCompilerGccSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.631 DEBUG: 'C++ (Community) CxxCompilerVcSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.632 DEBUG: 'C++ (Community) VeraxxSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.632 DEBUG: 'C++ (Community) ValgrindSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.632 DEBUG: 'C++ (Community) ClangTidySensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.633 DEBUG: 'C++ (Community) ClangSASensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.633 DEBUG: 'C++ (Community) ExternalRulesSensor' skipped because there is no related rule activated in the quality profile
00:01:34.069  12:52:43.633 DEBUG: 'C++ (Community) CoverageSensor' skipped because one of the required properties is missing
00:01:34.069  12:52:43.634 DEBUG: 'Import of Pylint issues' skipped because one of the required properties is missing
00:01:34.069  12:52:43.634 DEBUG: 'Import of Bandit issues' skipped because one of the required properties is missing
00:01:34.069  12:52:43.634 DEBUG: 'Import of Flake8 issues' skipped because one of the required properties is missing
00:01:34.069  12:52:43.651 DEBUG: 'C (Community) SquidSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.662 DEBUG: 'C (Community) RatsSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.670 DEBUG: 'C (Community) CppCheckSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.677 DEBUG: 'C (Community) PCLintSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.683 DEBUG: 'C (Community) DrMemorySensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.690 DEBUG: 'C (Community) CxxCompilerGccSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.698 DEBUG: 'C (Community) CxxCompilerVcSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.708 DEBUG: 'C (Community) VeraxxSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.717 DEBUG: 'C (Community) ValgrindSensor' skipped because there is no related file in current project
00:01:34.069  12:52:43.723 DEBUG: 'C (Community) ClangTidySensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.731 DEBUG: 'C (Community) ClangSASensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.739 DEBUG: 'C (Community) ExternalRulesSensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.745 DEBUG: 'C (Community) CoverageSensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.747 DEBUG: 'Import of stylelint issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.756 DEBUG: 'SonarGo' skipped because there is no related file in current project
00:01:34.335  12:52:43.764 DEBUG: 'Go Unit Test Report' skipped because there is no related file in current project
00:01:34.335  12:52:43.764 DEBUG: 'Go Cover sensor for Go coverage' skipped because one of the required properties is missing
00:01:34.335  12:52:43.773 DEBUG: 'Import of go vet issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.781 DEBUG: 'Import of Golint issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.787 DEBUG: 'Import of GoMetaLinter issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.794 DEBUG: 'Import of GolangCI-Lint issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.800 DEBUG: 'Kotlin Sensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.806 DEBUG: 'Import of detekt issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.807 DEBUG: 'Import of Android Lint issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.812 DEBUG: 'TypeScript analysis' skipped because there is no related file in current project
00:01:34.335  12:52:43.813 DEBUG: 'JavaScript/TypeScript Coverage' skipped because one of the required properties is missing
00:01:34.335  12:52:43.813 DEBUG: 'Import of ESLint issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.813 DEBUG: 'Import of TSLint issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.822 DEBUG: 'Ruby Sensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.823 DEBUG: 'Import of RuboCop issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.829 DEBUG: 'SimpleCov Sensor for Ruby coverage' skipped because there is no related file in current project
00:01:34.335  12:52:43.835 DEBUG: 'Scala Sensor' skipped because there is no related file in current project
00:01:34.335  12:52:43.835 DEBUG: 'Scoverage sensor for Scala coverage' skipped because one of the required properties is missing
00:01:34.335  12:52:43.842 DEBUG: 'Import of Scalastyle issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.850 DEBUG: 'Import of Scapegoat issues' skipped because there is no related file in current project
00:01:34.335  12:52:43.850 DEBUG: 'Import of Checkstyle issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.850 DEBUG: 'Import of PMD issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.851 DEBUG: 'Import of SpotBugs issues' skipped because one of the required properties is missing
00:01:34.335  12:52:43.851 DEBUG: 'Removed properties sensor' skipped because one of the required properties is missing
00:01:34.335  12:52:43.857 DEBUG: 'Flex' skipped because there is no related file in current project
00:01:34.335  12:52:43.863 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
00:01:34.335  12:52:43.865 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
00:01:34.335  12:52:43.865 DEBUG: 'C++ (Community) XunitSensor' skipped because one of the required properties is missing
00:01:34.335  12:52:43.865 DEBUG: Exist configuration parameter: 'sonar.cxx.vstest.reportsPaths':'false'
00:01:34.335  12:52:43.865 DEBUG: Exist configuration parameter: 'sonar.cxx.xunit.reportsPaths':'false'
00:01:34.335  12:52:43.865 DEBUG: Exist configuration parameter: 'sonar.cxx.nunit.reportsPaths':'false'
00:01:34.335  12:52:43.865 DEBUG: 'C++ (Community) Unit Test Results Import' skipped because one of the required properties is missing
00:01:34.335  12:52:43.865 DEBUG: 'C (Community) XunitSensor' skipped because one of the required properties is missing
00:01:34.335  12:52:43.865 DEBUG: Sensors : JavaSquidSensor -> C++ (Community) SquidSensor -> Python Sensor -> Cobertura Sensor for Python coverage -> PythonXUnitSensor -> CSS Metrics -> CSS Rules -> JaCoCo XML Report Importer -> JavaScript analysis -> C# Properties -> SurefireSensor -> JavaXmlSensor -> HTML -> XML Sensor -> PHP sensor -> Analyzer for "php.ini" files -> VB.NET Properties
00:01:34.335  12:52:43.866 INFO: Sensor JavaSquidSensor [java]
00:01:34.335  12:52:43.936 INFO: Configured Java source version (sonar.java.source): none
00:01:34.335  12:52:43.941 INFO: JavaClasspath initialization
00:01:34.335  12:52:43.953 INFO: ------------------------------------------------------------------------
00:01:34.335  12:52:43.953 INFO: EXECUTION FAILURE
00:01:34.335  12:52:43.953 INFO: ------------------------------------------------------------------------
00:01:34.335  12:52:43.953 INFO: Total time: 42.524s
00:01:34.600  12:52:44.043 INFO: Final Memory: 36M/1078M
00:01:34.600  12:52:44.043 INFO: ------------------------------------------------------------------------
00:01:34.600  12:52:44.043 ERROR: Error during SonarScanner execution
00:01:34.600  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.
00:01:34.600  	at org.sonar.java.JavaClasspath.init(JavaClasspath.java:64)
00:01:34.600  	at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
00:01:34.600  	at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:149)
00:01:34.600  	at org.sonar.java.JavaSquid.<init>(JavaSquid.java:75)
00:01:34.600  	at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:102)
00:01:34.600  	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
00:01:34.600  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
00:01:34.600  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
00:01:34.600  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
00:01:34.600  	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
00:01:34.600  	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
00:01:34.600  	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
00:01:34.600  	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
00:01:34.600  	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
00:01:34.600  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
00:01:34.600  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
00:01:34.600  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
00:01:34.600  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
00:01:34.600  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
00:01:34.600  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:01:34.600  	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:01:34.600  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:01:34.600  	at java.lang.reflect.Method.invoke(Method.java:498)
00:01:34.600  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
00:01:34.600  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
00:01:34.600  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
00:01:34.600  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
00:01:34.600  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
00:01:34.600  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
00:01:34.600  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

this is my pipeline:

        stage('SonarQube analysis') {
            steps{
                script{
                    def scannerHome = tool 'SonarMSBuild'
                    withSonarQubeEnv('Sonar_Server') {
                        bat """
                            ${scannerHome}\\sonar-scanner-4.4.0.2170\\bin\\sonar-scanner.bat -X -D sonar.c.suffixes.sources=- -Dsonar.c.suffixes.headers=-=- -Dsonar.lang.patterns.objectivec=- -Dsonar.c.file.suffixes=- -Dsonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp,.c,.h -Dsonar.projectKey=Boston -Dsonar.projectName=Boston -Dsonar.sources=./Source -Dsonar.scm.disabled=true -Dsonar.language=c++ -Dsonar.sourceEncoding=UTF-8
                        """
                    }
                }
            }
        }

As a newbie to SonarQube I am no able to understand the information the log is throwing. Any hint?

If you turn on DEBUG level logging (sonar-scanner -X) you should be able to see what files are being indexed with a .java extension.

Thanks for replying. I just realized there are some java files (newbie errors) but I do not know how to use sonar.exclusions, shall I just add something liket “-Dsonar.exclusions=C:\whaetver_path” and that whole path will be ignored?

-Dsonar.exclusions=**/*.java will do the trick!

it does the trick, thanks a lot!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.