Jenkins cannot run program sonar-runner - jenkins

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?

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

Related

issue in jenkins integration with git

i installed jenkins in c:\program files(x86)\jenkins and am trying to integrate with a helloworld java file. but when i first tried to build from jenkins, itself, its failed.
i went through this link : https://www.youtube.com/watch?v=bGqS0f4Utn4
when i compiled my java file, from the admin cmd prompt, its compiles successfully. but it failed within the jenkins console.
I created a C:\workspace folder and saved the java file, there.
what am doing wrong ? why am getting the wrong path within the console output?
am getting the below error in the console output :
`Console Output
Started by user user1
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\
HelloWorld
[HelloWorld] $ cmd /c call C:\Windows\TEMP\jenkins6223662388306682118.bat
C:\Program Files (x86)\Jenkins\workspace\HelloWorld>cd C:\Workspace
C:\Workspace>javac Hello.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>java Hello
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
First, since you've installed JDK, make sure you've added in system level environment variable
Set JDK bin path in Jenkins > manage jenkins > global tools configurations > jdk installations, then try
mostly this option would help to resolve

Jenkins2 installer in macOS change home directory

I am new to Jenkins, and I have the following problem
just installed Jenkins2 on MacOS Sierra (10.12.6)
and a new user has been created under /Users/Shared/Jenkins/,
but when I try to run a maven compile command, through a new Job
I have the following error:
[atmosphere] $ mvn -f spring-boot-samples/spring-boot-sample-atmosphere/pom.xml compile
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
I try to run the command manually and got the following:
Caused by: org.apache.maven.shared.filtering.MavenFilteringException:
Cannot create resource output directory:
/Users/Shared/Jenkins/Home/workspace/atmosphere/spring-boot-samples/spring-boot-sample-atmosphere/target/classes
How could I solve this ?
I guess I have to change the workspace permissions, but I don't know how to do that.
Please help !
It was really a newbie mistake.
I didn't have installed the maven plugin.
This post helped me to solve the problem.

Getting an error while integrating SonarQube with Jenkins

I followed the SonarQube Jenkins integration tutorial from SonarQube official website. I am getting an error after building my project.
[RetailerWebsite_releaseTestCodeDx] $ "C:\Program Files (x86)\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\sonar-scanner.bat" "SonarQube Scanner" -e -Dsonar.host.url=http://10.252.80.55:9000 -Dsonar.projectName=RetailerWebsite -Dsonar.projectVersion=1.0 -Dsonar.projectKey=Retailer-Website -Dsonar.sources=. -Dsonar.projectBaseDir=D:\Builds\RetailerWebsite_releaseTestCodeDx
\Jenkins2\tools\hudson.plugins.sonar.SonarRunnerInstallation\My_scanner\bin\..\jre was unexpected at this time.
ERROR: SonarQube scanner exited with non-zero code: 255
Project Configuration
Global Configuration
It appears you are victim of this Jenkins bug: when using a JRE installed at a path that includes parentheses, Jenkins (on Windows) tries to execute an invalid command.
Workaround: install the JDK elsewhere, and use that one in your Job configuration (or Jenkins itself).

Msbuild file with grunt giving error while executing from Jenkins

I am executing my Msbuild file from Jenkins using below command using Execute windows batch command option.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild "D:****\Build Scripts\BuildAndDeploy.proj"
this command executing perfectly from command prompt but in jenkins I am getting below error...
'grunt' is not recognized as an internal or external command,
operable program or batch file.
D:****\Build Scripts\BuildAndDeploy.proj(29,3): error MSB3073: The command "grunt build" exited with code 9009.
Done Building Project "D:*****\Build Scripts\BuildAndDeploy.proj" (default targets) -- FAILED.
Build FAILED.
Please suggest me how to handle this.
Thanks in advance.

Jenkins not Finding CVS on Solaris

I'm trying to pull from a CVS repository from Jenkins on a Solaris box. Jenkins is running under Tomcat and CVS is on the same machine as Jenkins and Tomcat. When I try to set up a Jenkins job that pulls from CVS it fails with the following stack trace:
Building in workspace /home/tomcat/.jenkins/jobs/compile xml/workspace
cvs checkout -P -D 23 May 2013 15:49:46 -0800 -d workspace xml
ERROR: CVS Authentication failed: Connection error
org.netbeans.lib.cvsclient.connection.AuthenticationException: Connection error
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:102)
at org.netbeans.lib.cvsclient.connection.LocalConnection.open(LocalConnection.java:145)
at org.netbeans.lib.cvsclient.Client$1.run(Client.java:374)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Cannot run program "cvs": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at org.netbeans.lib.cvsclient.connection.LocalConnection.openConnection(LocalConnection.java:95)
... 3 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 7 more
ERROR: Cvs task failed
It looks to me that Jenkins can't find cvs. When I log in as tomcat and type cvs, the command works. If I create a job in Jenkins and run the cvs command from the shell task, the command works. If I echo environment variables, such as PATH or CVSROOT, I get the expected results.
Where does Jenkins look for cvs? How can I set its path so it can see cvs?
-Update-
This looks similar: https://issues.jenkins-ci.org/browse/JENKINS-12633 but I have cvs installed on the server
The problem ended up being that Jenkins was getting its path from tomcat and tomcat was not getting the same path as the tomcat user (I assume because I'm starting tomcat as a service). I solved this by adding the following to the beginning of catalina.sh
PATH=$PATH:/path/to/cvs
export PATH

Resources