简体   繁体   中英

What do I set SONAR_RUNNER_HOME to in the Jenkins Global Tool Configuration for Sonarqube?

I'm trying to set up Sonarqube to run with Jenkins. I have both Jenkins and Sonarqube installed on an Ubuntu virtual machine that's running on a Windows 10 Hyper-V host. I downloaded Sonarqube to /opt/sonarqube and then followed the installation instructions at docs.sonarqube.org. I am able to get to Sonarqube at myserver:9000 from my host machine and localhost:9000 from my guest machine, so Sonarqube is installed correctly and running as far as I can tell.

I installed the Sonarqube Scanner plugin in Jenkins, but I'm having trouble with the configuration of SONAR_RUNNER_HOME in the Global Tool Configuration. I've tried setting it to both /opt/sonarqube and /opt/sonarqube/bin/linux-x86-64 , but in both cases building my Jenkins projects results in the error FATAL: SonarQube Scanner executable was not found for Local

What do I set SONAR_RUNNER_HOME to in Jenkins Global Tool Configuration?

Config installation from Maven in Global Tool Configuration in SonarQube Scanner installations in Jenkins.

Example how to use, where SonarQubeServer is name of SonarQube servers configuration in Jenkins Configure System . SonarQubeScanner name of SonarQube Scanner installations :

withSonarQubeEnv('SonarQubeServer') { 
    def sonarRunner = tool name: 'SonarQubeScanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
    sh """
       ${sonarRunner}/bin/sonar-scanner \
       -Dsonar.projectKey=your_project_key \
       -Dsonar.sources=.
    """
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM