Reputation: 206
I'm getting this error when running an analysis in Jenkins:
22:36:58.682 INFO: ------------------------------------------------------------------------
22:36:58.682 INFO: EXECUTION FAILURE
22:36:58.682 INFO: ------------------------------------------------------------------------
22:36:58.682 INFO: Total time: 2:18.929s
22:36:58.915 INFO: Final Memory: 44M/445M
22:36:58.915 INFO: ------------------------------------------------------------------------
22:36:58.915 ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
at org.sonar.scanner.report.ComponentsPublisher.convert(ComponentsPublisher.java:104)
at org.sonar.scanner.report.ComponentsPublisher.publish(ComponentsPublisher.java:69)
at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:152)
at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:138)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:366)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
The SonarQube server version is Version 7.9.1 (build 27448) (Enterprise). The SonarScanner in Jenkins is the 3.3.0.1492 version. The relevant pipeline execution args are the following:
withSonarQubeEnv('GDMSonarEnterprise') {
sh "${scannerHome}/bin/sonar-scanner"+
" -X -Dsonar.projectBaseDir="+parent+
" -Dsonar.projectKey="+key_sonar+
" -Dsonar.projectName="+name+
" -Dsonar.branch.name=master"+
" -Dsonar.projectVersion="+currentVersion.format("dd-MM-yyyy-HH:mm", TimeZone.getTimeZone('UTC'))+
" -Dsonar.java.coveragePlugin=jacoco"+
" -Dsonar.scm.disabled=false"+
" -Dsonar.modules="+modules+
" -Dsonar.verbose=true"+
" -Dsonar.login=somelogin"+
" -Dsonar.password=somepassword"+
" -Dsonar.svn.username=somelogin"+
" -Dsonar.svn.password.secured=somepassword"+
" -Dsonar.sources=src/main"+
" -Dsonar.exclusions=**/*.scss,**/*.xml,**/*.php,**/*.js,**/*.css,**/*.jsv,**/*.html,**/*.zul,**/Q*.java,**/*Test.java,**/*Test*.java,**/*.xsd,**/*.sql"+
" -Dsonar.lang.patterns.tsql=**/*.tsql"+
" -Dsonar.java.binaries=target"+
" -Dsonar.tests=src/test"
}
}
I've tried with and without the -Dsonar.login and -Dsonar.password arguments, since I have a token for the server (and in another Jenkins Job the whole operation goes smoothly).
Looking at the error log, it appears to be at the publish stage of the execution. For the record, the previous Maven build stage executes properly.
Any help is appreciated, and if there is more info needed I will try to provide it.
Cheers.
Upvotes: 3
Views: 3043
Reputation: 86
Check that the token/user has "execute analysis" permission in project settings -> permissions.
I was having the same exception, and eventually discovered that was the problem after trying to switch to the sonar-scanner command, which actually provided a useful error message.
Upvotes: 7