I’m trying to get SonarQube to run on my server as a Jenkins plugin. My server is running on Oracle Solaris 11.1 SPARC.
The Sonar Scanner version I’ve installed is sonar-scanner-3.3.0.1492-linux.
After changing file permissions and configuring Jenkins to run Sonar Scanner executable, currently when I try to build the project, in the console output, I currently get the following message:
[-Trunk] $ //sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner -X -Dsonar.host.url= -Dsonar.projectBaseDir=//sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner[59]: exec: //sonar-scanner-3.3.0.1492-linux/jre/bin/java: cannot execute [Invalid argument]
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 126
Finished: FAILURE
I can’t find any information on the error code 126, and there doesn’t seem to be much information about installing SonarQube on a non internet-connected server.
Setting projectBaseDir at all is suspicious in itself; you should execute analysis from the projectBaseDir and then not need to set it. The fact that you appear to have set this value to… the location of your scanner executable is just wrong.
You need to put sonar-scanner in your $PATH, then cd into your project root and execute it. Typically your project settings will be in a file named sonar-project.properties in your project root, or if not there, then passed on the command line. At a minimum you need to provide the location of your SonarQube server (sonar.host.url), your project key (sonar.projectKey) and the location of your source files (sonar.sources). A few more will be required if this is a Java project, but for most other languages this is enough to get you going.
Regarding default host URL, I am trying to use sonar scanner on jenkins, so would this setting be under Manage Jenkins -> Configure System -> SonarQube servers -> Server URL? Because currently that is configured to the IP of the server. Should I be setting it back to default?
Also, the reason its pointing to the scanner is because initially I received this error:
FATAL: SonarQube Scanner executable was not found for SonarQube Scanner
To be honest I have no idea of any of the settings required for this. The project I’m trying to install this on is an almost decade old project running on Struts 1. Do I need to create a separate sonarqube server before I can run it on Jenkins? The documentation for SonarQube is not quite clear on this. Most tutorials I’ve seen directly install SonarQube as a plugin on Jenkins, but those tutorials tend to have internet connection and are thus able to configure Sonar Scanner automatically.