From 2f452afdc7ce01f3ddedeecb1a5061985ff2443d Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sun, 14 Dec 2025 13:17:59 -0800 Subject: [PATCH] try this instead part 3 --- Jenkinsfile | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 754b697c2..5f110cae8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,28 +25,27 @@ pipeline { } } - stage('Deploy to Nexus') { - steps { - withCredentials([usernamePassword( - credentialsId: 'nexus-deployer', - usernameVariable: 'NEXUS_USER', - passwordVariable: 'NEXUS_PASS' - )]) { - writeFile file: 'settings.xml', text: """ - - - - neetgames - ${env.NEXUS_USER} - ${env.NEXUS_PASS} - - - - """ - sh 'mvn -s settings.xml -V -B deploy' - } - } - } + stage('Deploy to Nexus') { + steps { + withCredentials([usernamePassword( + credentialsId: 'nexus-deployer', + usernameVariable: 'NEXUS_USER', + passwordVariable: 'NEXUS_PASS' + )]) { + configFileProvider([configFile(fileId: 'maven-settings-nexus', variable: 'MAVEN_SETTINGS_TEMPLATE')]) { + sh ''' + # Expand env vars into a real settings file + envsubst < "$MAVEN_SETTINGS_TEMPLATE" > settings.xml + + mvn -s settings.xml -V -B deploy + + rm -f settings.xml + ''' + } + } + } + } + } post {