Reputation: 71
Is there a way to configure ANT- and MAVEN-Installations using CLI? For the JDK there is:
dis = new hudson.model.JDK.DescriptorImpl();
dis.setInstallations( new hudson.model.JDK("JDK8", "/usr/lib/jvm/java-1.8-openjdk"));
Tobi
Upvotes: 4
Views: 3985
Reputation: 8896
It the way to set maven using Groovy:
def inst = Jenkins.getInstance()
def desc = inst.getDescriptor("hudson.tasks.Maven")
def minst = new hudson.tasks.Maven.MavenInstallation("Maven_name", "maven_path");
desc.setInstallations(minst)
desc.save()
Upvotes: 3
Reputation: 11775
You can find out the corresponding descriptors by manually changing Global Tool Configuration
and then looking at the xml config files created in JENKINS_HOME
.
For example, for Maven it must be hudson.tasks.Maven.DescriptorImpl
and for Ant - hudson.tasks.Ant.DescriptorImpl
Upvotes: 2