Jenkins build fails to run the SonarQube scanner

I am using the following versions of software

  • SonarQube 8.5.0.37579 (developer edition)
  • SonarScanner 4.5.0.2216
  • Jenkins GitHub Branch Source Plugin 2.9.1
  • SonarQube Scanner for Jenkins 2.12

I am trying to set up scanning of my GitHub repository on push and PR using Jenkins. Everything seems to be set up according to the instructions that popped up in SonarQube after I created a project from GitHub repo.

Jenkins build step “SonarQube Analysis” keeps failing and there is nothing logged from the console. I also noticed there is nothing new in the SonarQube logs. Is there something I missed? Can you please suggest what might me wrong?

I’ve attached my Jenkins file for reference.
Jenkinsfile.txt (205 Bytes)

Hi,

There’s really nothing in your Jenkins log?

Have you checked out the docs on using a Jenkins pipeline? The sample code there doesn’t look like yours…

 
Ann

Hi @ganncamp,

there is absolutely nothing in the sonarqube and elasticsearch logs.

My code is a little different from your docs. I followed in instructions in SonarQube. Screenshots attached below. Is something missing in the instructions?

Hi @ganncamp,

same new logs appeared in Jenkins:

/var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarCube_Scanner/bin/sonar-scanner
Could not find 'java' executable in JAVA_HOME or PATH. 

I have Java JRE and JDK installed on the system. I restarted Jenkins just in case it needed to pick up the JAVA_HOME variable from the system, but there’s no change.

I can see JAVA_HOME being set in the SSH console:

root@ubuntu-s-4vcpu-8gb-ams3-01:~# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/bin/java

It is also configured in Jenkins settings. What would you advise?

Hi,

I’d go back to the basics. Start by having your pipeline echo/print out the current values for $JAVA_HOME and $PATH.

 
Ann