From 37c439fdb65fb2f735335908aa2be51ab8b33e8c Mon Sep 17 00:00:00 2001 From: shekarsanu Date: Fri, 14 Jun 2024 02:10:38 -0400 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 41af9186..7ca5977b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,32 @@ -podTemplate(containers: [containerTemplate(name: 'maven', image: 'maven', command: 'sleep', args: 'infinity')]) { - node(POD_LABEL) { - checkout scm - container('maven') { - sh 'mvn -B -ntp -Dmaven.test.failure.ignore verify' +pipeline { + agent any + + tools { + // Install the Maven version configured as "M3" and add it to the path. + maven "M3" + } + + stages { + stage('Build') { + steps { + // Get some code from a GitHub repository + git 'https://github.com/jglick/simple-maven-project-with-tests.git' + + // Run Maven on a Unix agent. + sh "mvn -Dmaven.test.failure.ignore=true clean package" + + // To run Maven on a Windows agent, use + // bat "mvn -Dmaven.test.failure.ignore=true clean package" + } + + post { + // If Maven was able to run the tests, even if some of the test + // failed, record the test results and archive the jar file. + success { + junit '**/target/surefire-reports/TEST-*.xml' + archiveArtifacts 'target/*.jar' + } + } + } } - junit '**/target/surefire-reports/TEST-*.xml' - } }