-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Build] Use Maven-Daemon to speed up Maven artifact publication
- Loading branch information
1 parent
459446b
commit b04cfa5
Showing
1 changed file
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ pipeline { | |
} | ||
environment { | ||
REPO = "${WORKSPACE}/repo" | ||
PATH = "${installMavenDaemon('1.0.2')}/bin:${PATH}" | ||
// Folder ~/.m2 is not writable for builds, ensure mvnd metadata are written within the workspace. | ||
// prevent jline warning about inability to create a system terminal and increase keep-alive timeouts to increase stability in concurrent usage | ||
MVND = "mvnd -Dmvnd.daemonStorage=${WORKSPACE}/tools/mvnd -Dorg.jline.terminal.type=dumb -Dmvnd.keepAlive=1000 -Dmvnd.maxLostKeepAlive=100 --no-transfer-progress" | ||
} | ||
// parameters declared in the definition of the invoking job | ||
stages { | ||
|
@@ -64,7 +68,7 @@ pipeline { | |
# Get each artifact and all its transitive dependencies from the Mavenized repository. | ||
set -x | ||
for i in $(cat coordinates.txt); do | ||
mvn dependency:get --no-transfer-progress -Dosgi.platform=gtk.linux.x86_64 -Dartifact=$i -DremoteRepositories=file://${REPO} | ||
${MVND} dependency:get -Dosgi.platform=gtk.linux.x86_64 -Dartifact=$i -DremoteRepositories=file://${REPO} | ||
done | ||
''' | ||
} | ||
|
@@ -160,7 +164,7 @@ pipeline { | |
fi | ||
set -x | ||
|
||
mvn -f "${configurationPom}" -s ${SETTINGS} --no-transfer-progress \\ | ||
${MVND} -f "${configurationPom}" -s ${SETTINGS} \\ | ||
gpg:sign-and-deploy-file -Dgpg.key.id=${GPG_KEY_ID} \\ | ||
-Durl=${URL} -DrepositoryId=${MAVEN_REPO} \\ | ||
-DpomFile=${pomFile} -Dfile=${file} \\ | ||
|
@@ -186,4 +190,15 @@ pipeline { | |
to: '[email protected]', from:'[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
|
||
def installMavenDaemon(String version){ | ||
return install('mvnd', "https://downloads.apache.org/maven/mvnd/${version}/maven-mvnd-${version}-linux-amd64.tar.gz") | ||
} | ||
|
||
def install(String toolType, String url) { | ||
dir("${WORKSPACE}/tools/${toolType}") { | ||
sh "curl -L ${url} | tar -xzf -" | ||
return "${pwd()}/" + sh(script: 'ls', returnStdout: true).strip() | ||
} | ||
} |