-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
2002.tool-maven.groovy
20 lines (18 loc) · 1.01 KB
/
2002.tool-maven.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import jenkins.plugins.git.*;
println "///////////////////////////////////////////////////////////////////////////"
println "Init Hook: Tool installation, maven"
println "///////////////////////////////////////////////////////////////////////////"
def mavenPluginExtension = Jenkins.instance.getExtensionList(hudson.tasks.Maven.DescriptorImpl.class)[0]
def mavenInstallations = (mavenPluginExtension.installations as List)
if(!mavenInstallations.any { it.getName() == 'maven 3.3.9' }){
mavenInstallations.add(new hudson.tasks.Maven.MavenInstallation('maven 3.3.9', null,
[new hudson.tools.InstallSourceProperty([new hudson.tasks.Maven.MavenInstaller("3.3.9")])]
))
}
if(!mavenInstallations.any { it.getName() == 'maven 2.2.1' }){
mavenInstallations.add(new hudson.tasks.Maven.MavenInstallation('maven 2.2.1', null,
[new hudson.tools.InstallSourceProperty([new hudson.tasks.Maven.MavenInstaller("2.2.1")])]
))
}
mavenPluginExtension.installations = mavenInstallations
mavenPluginExtension.save()