Skip to content

Commit

Permalink
Merge branch 'alpine' into 2.138.x-alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkernel committed Oct 29, 2018
2 parents 18d2c66 + 24415e2 commit 4191479
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
34 changes: 34 additions & 0 deletions init.groovy.d/general_maven.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import jenkins.model.*;
import hudson.tools.*;
import hudson.tasks.Maven.MavenInstaller;
import hudson.tasks.Maven.MavenInstallation;
import org.jenkinsci.plugins.configfiles.maven.*
import org.jenkinsci.plugins.configfiles.maven.security.*

// Constants
def instance = Jenkins.getInstance()
Expand Down Expand Up @@ -37,6 +39,38 @@ Thread.start {
desc_MavenTool.setInstallations((MavenInstallation[]) maven_installations)
desc_MavenTool.save()

// Configuring global maven settings
def mirrorUrl = System.getenv("NEXUS_REPO")
if (mirrorUrl) {
println("--> Configuring global maven settings")
def store = instance.getExtensionList('org.jenkinsci.plugins.configfiles.GlobalConfigFiles')[0]
def configId = 'global-maven-settings'
def configName = 'global-maven-settings'
def configComment = 'Maven Mirror Settings'
def configContent = """<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<mirrors>
<mirror>
<id>nexus</id>
<name>Local Maven Repository Manager</name>
<url>${mirrorUrl}</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>deployment</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
</settings>
"""
def globalConfig = new GlobalMavenSettingsConfig(configId, configName, configComment, configContent, false, null)
store.save(globalConfig)
}

// Save the state
instance.save()
}
39 changes: 0 additions & 39 deletions init.groovy.d/maven-settings.groovy

This file was deleted.

0 comments on commit 4191479

Please sign in to comment.