2025-12-13 16:32:47 +00:00
|
|
|
pipeline {
|
|
|
|
|
agent any
|
|
|
|
|
|
|
|
|
|
tools {
|
|
|
|
|
// Install the Maven version configured as "M3" and add it to the path.
|
|
|
|
|
maven "M398"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stages {
|
|
|
|
|
stage('Echo Version') {
|
|
|
|
|
steps {
|
|
|
|
|
// Get some code from a GitHub repository
|
|
|
|
|
sh 'echo Print Maven Version'
|
|
|
|
|
sh "mvn -version "
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stage('Build') {
|
|
|
|
|
steps {
|
|
|
|
|
// Get some code from a GitHub repository (not needed if the file is part of repo )
|
|
|
|
|
// git branch: 'main', changelog: false, credentialsId: 'forgejo-https', poll: false, url: 'https://forgejo.tben.online/sandbox/jenkins-hello-world.git'
|
|
|
|
|
// Run Maven package
|
|
|
|
|
sh "mvn clean package -DskipTests=true"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stage('Unit Test') {
|
|
|
|
|
steps {
|
2025-12-13 17:36:11 +00:00
|
|
|
script {
|
|
|
|
|
for (int i = 0 ; i < 60; i++) {
|
2025-12-13 17:33:12 +00:00
|
|
|
echo "${i + 1}"
|
|
|
|
|
sleep 1
|
2025-12-13 17:36:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sh "mvn test"
|
|
|
|
|
}
|
2025-12-13 16:32:47 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|