Added Jenkinsfile

This commit is contained in:
Benjamin Tan 2025-12-15 01:47:54 +08:00
parent be9dddeb02
commit dace389f04

27
Jenkinsfile vendored
View file

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