We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0d69895 commit eea94e7Copy full SHA for eea94e7
1 file changed
jenkinsfile.groovy
@@ -0,0 +1,37 @@
1
+node('java') {
2
+
3
+stage('Checkout') {
4
+checkout([$class: 'GitSCM',
5
+branches: [[name: 'main']],
6
+userRemoteConfigs: [[url: 'https://github.com/BinduPrivate/java-example.git']]
7
+])
8
+}
9
10
+stage('Test') {
11
+try {
12
+sh 'mvn clean test'
13
+echo 'Running unit test and integration test'
14
+} catch (Exception e) {
15
+error 'Tests failed!'
16
17
18
19
+stage('Build') {
20
21
+sh 'mvn clean package'
22
+echo 'Build successful'
23
24
+error 'Build failed!'
25
26
27
28
+stage('Deploy') {
29
30
31
+sh 'sudo rsync -av /home/ubuntu/jenkins/workspace/artifact-deployment/target/works-with-heroku-1.0.war /opt/apache-tomcat-9.0.96/webapps'
32
+echo 'Successfully deployed'
33
34
+error 'Deployment failed!'
35
36
37
0 commit comments