I've done something similar for Maven, see below

import hudson.tasks.Maven
import hudson.tools.InstallSourceProperty
import jenkins.model.Jenkins

def mvn2 = new Maven.MavenInstallation('maven_2.3.3', null, [new 
InstallSourceProperty([new Maven.MavenInstaller('2.3.3')])])
def mvn3 = new Maven.MavenInstallation('maven_3.3.3', null, [new 
InstallSourceProperty([new Maven.MavenInstaller('3.3.3')])])
def mvnList = [mvn2, mvn3]

mvnDescriptor = 
Jenkins.instance.getExtensionList(hudson.tasks.Maven.DescriptorImpl.class)[0];
currentMvnList = (mvnDescriptor.installations as List);

mvnList.each {
    println "INFO: adding '${it.getName()}'"
    currentMvnList.add(it)
    mvnDescriptor.installations = currentMvnList
    mvnDescriptor.save()
}

You can look at the below javadoc:
- http://javadoc.jenkins-ci.org/hudson/tasks/Ant.AntInstaller.html
- http://javadoc.jenkins-ci.org/hudson/tasks/Ant.html
- http://javadoc.jenkins-ci.org/hudson/tools/InstallSourceProperty.html

I hope it helps

On Thursday, 10 March 2016 10:11:28 UTC, [email protected] wrote:
>
> Hi,
>
> i am looking for a way to configure the ant-plugin via groovy. Can anybody 
> point me to an example or doc?
> I have been searching for a while now without success.
>
> regards,
> Roman
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7ee7d784-646a-43df-b1a3-ef9e6c7e8756%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to