Change the default maven settings in the first stage and restore them as post-action.

This commit is contained in:
Manuele Simi 2019-10-10 10:43:24 -04:00
parent b9c2e5a12c
commit 2c38138c00
1 changed files with 19 additions and 0 deletions

19
Jenkinsfile vendored
View File

@ -93,6 +93,9 @@ pipeline {
echo "Create a fresh local repository"
rm -rf $MAVEN_LOCAL_REPO
mkdir -p $MAVEN_LOCAL_REPO
// default the selected maven settings
mv "${agent_root_folder}/settings.xml" "${agent_root_folder}/settings.${PIPELINE_BUILD_NUMBER}"
cp "${agent_root_folder}/${maven_settings_file}" "${agent_root_folder}/settings.xml"
echo "Done with local repository"
'''
@ -189,6 +192,22 @@ pipeline {
}
}
// post-build actions
post {
always {
// restore the default maven settings
mv "${agent_root_folder}/settings.${PIPELINE_BUILD_NUMBER}" "${agent_root_folder}/settings.xml"
echo 'The default maven settings have been restored'
}
success {
echo 'The pipeline worked!'
}
failure {
echo 'The pipeline has failed'
}
}
}
def buildComponents(args, maven_settings_file, maven_local_repo_path) {