Skip to content

Commit eba820e

Browse files
authored
Update Jenkinsfile
1 parent c375d67 commit eba820e

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Jenkinsfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pipeline {
77
steps {
88
// Only build if source is already available; skip checkout on master
99
bat "mvn clean package"
10-
stash includes: 'target/*.jar', name: 'myAppJar'
1110
}
1211
}
1312

@@ -17,21 +16,30 @@ pipeline {
1716
agent { label 'server1' }
1817
tools { git 'LinuxGit' }
1918
steps {
20-
git url: 'https://github.com/pavan203/simple-java-maven-app.git', branch: 'master'
21-
unstash 'myAppJar'
22-
sh "java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
19+
sh 'mvn package -DskipTests'
20+
}
21+
22+
post {
23+
success {
24+
archiveArtifacts 'target/*.jar'
25+
echo 'Package created successfully!'
26+
}
2327
}
2428
}
2529
stage('Server2') {
2630
agent { label 'server2' }
2731
tools { git 'LinuxGit' }
2832
steps {
29-
git url: 'https://github.com/pavan203/simple-java-maven-app.git', branch: 'master'
30-
unstash 'myAppJar'
31-
sh "java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App"
33+
sh 'mvn package -DskipTests'
34+
}
35+
36+
post {
37+
success {
38+
archiveArtifacts 'target/*.jar'
39+
echo 'Package created successfully!'
40+
}
3241
}
3342
}
34-
}
3543
}
3644
}
3745

0 commit comments

Comments
 (0)