Search code examples
jenkinssonar-runner

Jenkins cannot run program sonar-runner


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?


Solution

  • 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