File tree Expand file tree Collapse file tree
src/test/java/com/mycompany/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11package com .mycompany .app ;
22
3- import org .junit .jupiter .api .Test ;
4-
53import static org .junit .jupiter .api .Assertions .assertEquals ;
4+ import org .junit .jupiter .api .Test ;
65
76/**
87 * Unit test for simple App.
You can’t perform that action at this time.
0 commit comments