|
@ -1,32 +1,25 @@ |
|
|
pipeline { |
|
|
|
|
|
agent any |
|
|
|
|
|
|
|
|
|
|
|
// tools { |
|
|
|
|
|
// Install the Maven version configured as "M3" and add it to the path. |
|
|
|
|
|
//maven "M3" |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
stages { |
|
|
|
|
|
stage('Build') { |
|
|
|
|
|
steps { |
|
|
|
|
|
|
|
|
node { |
|
|
|
|
|
def mvnHome |
|
|
|
|
|
stage('Preparation') { // for display purposes |
|
|
// Get some code from a GitHub repository |
|
|
// Get some code from a GitHub repository |
|
|
git 'https://gogs.informatik.hs-fulda.de/Continous_Integration_in_der_Praxis/colaboration-training.git' |
|
|
git 'https://gogs.informatik.hs-fulda.de/Continous_Integration_in_der_Praxis/colaboration-training.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" |
|
|
|
|
|
|
|
|
// Get the Maven tool. |
|
|
|
|
|
// ** NOTE: This 'M3' Maven tool must be configured |
|
|
|
|
|
// ** in the global configuration. |
|
|
|
|
|
mvnHome = tool 'M3' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
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' |
|
|
|
|
|
|
|
|
stage('Build') { |
|
|
|
|
|
// Run the maven build |
|
|
|
|
|
withEnv(["MVN_HOME=$mvnHome"]) { |
|
|
|
|
|
if (isUnix()) { |
|
|
|
|
|
sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package' |
|
|
|
|
|
} else { |
|
|
|
|
|
bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
stage('Results') { |
|
|
|
|
|
// junit '**/target/surefire-reports/TEST-*.xml' |
|
|
|
|
|
archiveArtifacts 'target/*.jar' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |