Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created February 26, 2012 01:09
Show Gist options
  • Select an option

  • Save kellyrob99/1912014 to your computer and use it in GitHub Desktop.

Select an option

Save kellyrob99/1912014 to your computer and use it in GitHub Desktop.
Launch an interactive Groovy shell to a Jenkins server
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/')
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository")
@Grab('org.kar:hudson-api:0.2-SNAPSHOT')
@GrabExclude('org.codehaus.groovy:groovy')
import org.kar.hudson.api.cli.HudsonCliApi
/**
* Open an interactive Groovy shell that imports the hudson.model.* classes and exposes
* a 'hudson' and/or 'jenkins' object in the Binding which is an instance of hudson.model.Hudson
*/
HudsonCliApi cliApi = new HudsonCliApi()
String rootUrl = args ? args[0] :'http://localhost:8080'
cliApi.runCliCommand(rootUrl, 'groovysh')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment