Sample pipeline configuration in Jenkins for a project that uses GitHub as the SCM, builds with Maven, and deploys artifacts to Artifactory
pipeline {
agent any
tools {
maven 'Maven 3.6.3'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Deploy to Artifactory') {
steps {
script {
def server = Artifactory.server 'ArtifactoryServer'
def auth = Artifactory.getCredentialsId('Jenkins creds')
server.upload(auth, 'my-repo', 'my-project/target/*.jar')
}
}
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}