Skip to content

Instantly share code, notes, and snippets.

@willis7
Created July 11, 2018 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willis7/2ca615cd7f9399fbd5f1575731a4b82b to your computer and use it in GitHub Desktop.
Save willis7/2ca615cd7f9399fbd5f1575731a4b82b to your computer and use it in GitHub Desktop.
This adds a runner that will be installed automatically from Maven central
import jenkins.model.*
import hudson.plugins.sonar.*
import hudson.tools.*
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("hudson.plugins.sonar.SonarRunnerInstallation")
def installer = new SonarRunnerInstaller("[sonar runner version]")
def prop = new InstallSourceProperty([installer])
def sinst = new SonarRunnerInstallation("[name of the sonar runner - I called it Default]", "[home? - not sure how this is used and I left it blank]", [prop])
desc.setInstallations(sinst)
desc.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment