Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configure Jenkins "Global Tool Configuration" using CLI / groovy

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

like image 463
Tobi Avatar asked Oct 16 '25 17:10

Tobi


1 Answers

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()
like image 88
Singhak Avatar answered Oct 18 '25 14:10

Singhak