Add deploy to Nexus stage

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

79
Jenkinsfile vendored
View File

@@ -1,35 +1,60 @@
pipeline { pipeline {
agent any agent any
tools { tools {
jdk 'jdk17' jdk 'jdk17'
} // If you configured Maven as a Jenkins tool, add:
// maven 'Maven3'
}
options { options {
timestamps() timestamps()
disableConcurrentBuilds() disableConcurrentBuilds()
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage('Build') { stage('Build') {
steps { steps {
sh ''' sh 'mvn -V -B clean package'
mvn -V -B clean package }
''' }
}
}
}
post { stage('Deploy to Nexus') {
success { when {
archiveArtifacts artifacts: 'target/mcMMO.jar', fingerprint: true 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'
}
}
}
}
post {
success {
archiveArtifacts artifacts: 'target/mcMMO.jar', fingerprint: true
}
}
} }