Created
October 9, 2015 12:55
-
-
Save tszpinda/53e958cf80b0f532c787 to your computer and use it in GitHub Desktop.
install maven in jenkins via groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# command line to execute. | |
java -jar jenkins-cli.jar -s http://localhost:8080/ groovy install-maven-in-jenkins.groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// install maven | |
// file: maven3.groovy | |
import jenkins.* | |
import jenkins.model.* | |
import hudson.* | |
import hudson.model.* | |
a=Jenkins.instance.getExtensionList(hudson.tasks.Maven.DescriptorImpl.class)[0]; | |
b=(a.installations as List); | |
b.add(new hudson.tasks.Maven.MavenInstallation("MAVEN3", "/home/jenkins/apache-maven/apache-maven-3.2.3", [])); | |
a.installations=b | |
a.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment