Add deploy to Nexus stage

This commit is contained in:
nossr50
2025-12-14 12:52:27 -08:00
parent f9acdeaf14
commit 6b6263d0b3

33
Jenkinsfile vendored
View File

@@ -3,6 +3,8 @@ pipeline {
tools { tools {
jdk 'jdk17' jdk 'jdk17'
// If you configured Maven as a Jenkins tool, add:
// maven 'Maven3'
} }
options { options {
@@ -19,9 +21,33 @@ pipeline {
stage('Build') { stage('Build') {
steps { steps {
sh ''' sh 'mvn -V -B clean package'
mvn -V -B clean package }
''' }
stage('Deploy to Nexus') {
when {
branch 'master'
}
steps {
withCredentials([usernamePassword(
credentialsId: 'nexus-deployer',
usernameVariable: 'NEXUS_USER',
passwordVariable: 'NEXUS_PASS'
)]) {
writeFile file: 'settings.xml', text: """
<settings>
<servers>
<server>
<id>neetgames</id>
<username>${env.NEXUS_USER}</username>
<password>${env.NEXUS_PASS}</password>
</server>
</servers>
</settings>
"""
sh 'mvn -s settings.xml -V -B deploy'
}
} }
} }
} }
@@ -31,5 +57,4 @@ pipeline {
archiveArtifacts artifacts: 'target/mcMMO.jar', fingerprint: true archiveArtifacts artifacts: 'target/mcMMO.jar', fingerprint: true
} }
} }
} }