Skip to content

Commit 880faee

Browse files
authored
Merge pull request #4 from DefinitelyNotTzeJing/branch3
Branch3
2 parents 19e1f4b + af07d3c commit 880faee

5 files changed

Lines changed: 57 additions & 56 deletions

File tree

Jenkinsfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
pipeline {
2+
agent any
3+
stages {
4+
stage('Checkout') {
5+
steps {
6+
git branch: 'branch3', url: 'https://github.com/Vanny253/simple-java-maven-app.git'
7+
}
8+
}
9+
stage('Build') {
10+
steps {
11+
bat 'mvn clean package -DskipTests'
12+
}
13+
}
14+
stage('Test') {
15+
steps {
16+
bat 'mvn test'
17+
}
18+
post {
19+
always {
20+
junit 'target/surefire-reports/*.xml' // This will show test results in Jenkins
21+
}
22+
}
23+
}
24+
stage('Deliver') {
25+
steps {
26+
bat 'jenkins\\scripts\\deliver.bat'
27+
}
28+
}
29+
}
30+
post {
31+
always {
32+
echo 'Cleaning up workspace'
33+
deleteDir() // Clean up the workspace after the build
34+
}
35+
success {
36+
echo 'Build succeeded!!!'
37+
}
38+
failure {
39+
echo 'Build failed!'
40+
}
41+
}
42+
}
43+
44+

jenkins/Jenkinsfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

jenkins/scripts/deliver.bat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@echo off
2+
REM Install your Maven-built JAR into the local repo
3+
echo Running Maven install into Jenkins's local repository…
4+
mvn jar:jar install:install help:evaluate -Dexpression=project.name
5+
6+
REM Read project name and version from the POM
7+
for /f "delims=" %%N in ('mvn -q -DforceStdout help:evaluate -Dexpression=project.name') do set "NAME=%%N"
8+
for /f "delims=" %%V in ('mvn -q -DforceStdout help:evaluate -Dexpression=project.version') do set "VERSION=%%V"
9+
10+
REM Run the built JAR so you can see its output in the console
11+
echo Launching JAR target\%NAME%-%VERSION%.jar…
12+
java -jar target\%NAME%-%VERSION%.jar

jenkins/scripts/deliver.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/test/java/com/mycompany/app/AppTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.mycompany.app;
22

3-
import org.junit.jupiter.api.Test;
4-
53
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
65

76
/**
87
* Unit test for simple App.

0 commit comments

Comments
 (0)