0
votes

Installed:

Sonarqube 5.5

Sonar-runner 2.4 (http://dev.mamikon.net/installing-sonarqube-runner-on-ubuntu/)

When I try to run Jenkins with a simple project, this is the error I get:

[test] $ sonar-runner -e -Dsonar.host.url=http://server_url:9000/sonar/ -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/test

SONAR ANALYSIS FAILED

FATAL: command execution failed. java.io.IOException: Cannot run program "sonar-runner" (in directory "/var/lib/jenkins/workspace/test"): error=2, No such file or directory

It seems that jenkins cannot find the sonar-runner program. But when I open the server with a terminal, and run sonar-runner, it analyzes the project.

Can someone help me with this?

1
Best guess: Jenkins has a sandboxed environment, you need to go into your jenkins config and add the sonar-runner location to Jenkin's path before it will know where to find it. You'll need to figure out where the SonarRunner executable is installed.Tuffwer
@Tuffwer I somehow cannot set that variable. The sonar plugin from jenkins let met only configure the sonar server. (jenkins 2.5)reinier stam
Did you follow all of the setup instructions on the Sonar Qube for Jenkins setup wiki?Tuffwer
yes, i did follow they instructions.reinier stam
Okay reading the error message, have you verified (by going to the directory in your terminal outside of Jenkins) that /var/lib/jenkins/workspace/test actually exists. If you have the sonarqube job as a seperate jenkins job it may have it's own workspace and thus not have that test directory when it should be there.Tuffwer

1 Answers

1
votes

after hours of frustration, it turned out i had to add environment variable in the /etc/profile file.

export SONAR_RUNNER_HOME=/opt/sonar-runner

export PATH=$PATH:$SONAR_RUNNER_HOME/bin