pipeline { agent any tools { maven 'Maven 3.9.9' // Change this to the needed maven installation } environment { MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository' } stages { stage('Build') { steps { sh 'mvn clean install' } } stage('Archive Artifacts') { steps { script { def artifact = sh(script: "mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout", returnStdout: true).trim() archiveArtifacts artifacts: "**/target/${artifact}-*.jar", fingerprint: true, allowEmptyArchive: true } } } // Uncomment this section to send notification to Discord. Replace with the webhook url. // - Requirement: Discord Notifier plugin installed in Jenkins // stage('Notify Discord') { // steps { // script { // discordSend webhookURL: '', title: "${env.JOB_NAME} #${env.BUILD_NUMBER}", enableArtifactsList: true, showChangeset: true, link: env.BUILD_URL, result: currentBuild.currentResult // } // } // } } }