├── webapp
├── src
│ ├── site
│ │ └── apt
│ │ │ └── index.apt
│ └── main
│ │ └── webapp
│ │ ├── index.jsp
│ │ └── WEB-INF
│ │ └── web.xml
└── pom.xml
├── .gitignore
├── server
├── src
│ ├── site
│ │ └── apt
│ │ │ └── index.apt
│ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── Greeter.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── TestGreeter.java
└── pom.xml
├── README.md
├── Jenkinsfile
├── ScriptedPipeline_Jenkinsfile.txt
├── DeclarativePipeline_Jenkinsfile
└── pom.xml
/webapp/src/site/apt/index.apt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | file1
3 | file2
4 |
--------------------------------------------------------------------------------
/webapp/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | Hello, World!
--------------------------------------------------------------------------------
/server/src/site/apt/index.apt:
--------------------------------------------------------------------------------
1 | Headline
2 |
3 | Content
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | New changes done by developer
2 |
3 | some more changes dondddddddeddd
4 |
5 |
6 | cccccc
7 |
8 |
--------------------------------------------------------------------------------
/server/src/main/java/com/example/Greeter.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | /**
4 | * This is a class.
5 | */
6 | public class Greeter {
7 |
8 | /**
9 | * This is a constructor.
10 | */
11 | public Greeter() {
12 |
13 | }
14 |
15 | //TODO: Add javadoc comment
16 | public String greet(String someone) {
17 | return String.format("Hello, %s!", someone);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/webapp/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | Webapp
7 |
17 |
18 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | node('built-in')
2 | {
3 | stage('Continuous Download')
4 | {
5 | git 'https://github.com/sunildevops77/maven.git'
6 | }
7 | stage('Continuous Build')
8 | {
9 | sh label: '', script: 'mvn package'
10 | }
11 | stage('Continuous Deployment')
12 | {
13 | sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/ScriptedPipeline/webapp/target/webapp.war ubuntu@172.31.26.217:/var/lib/tomcat8/webapps/qaenv.war'
14 | }
15 | stage('Continuous Testing')
16 | {
17 | sh label: '', script: 'echo "Testing Passed"'
18 | }
19 | stage('Continuous Delivery')
20 | {
21 | sh label: '', script: 'scp /home/ubuntu/.jenkins/workspace/ScriptedPipeline/webapp/target/webapp.war ubuntu@172.31.22.88:/var/lib/tomcat8/webapps/prodenv.war'
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/server/src/test/java/com/example/TestGreeter.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.junit.Before;
4 | import org.junit.Test;
5 |
6 | import static org.hamcrest.CoreMatchers.is;
7 | import static org.hamcrest.Matchers.greaterThan;
8 | import static org.junit.Assert.assertThat;
9 | import static org.junit.matchers.JUnitMatchers.containsString;
10 |
11 | public class TestGreeter {
12 |
13 | private Greeter greeter;
14 |
15 | @Before
16 | public void setup() {
17 | greeter = new Greeter();
18 | }
19 |
20 | @Test
21 | public void greetShouldIncludeTheOneBeingGreeted() {
22 | String someone = "World";
23 |
24 | assertThat(greeter.greet(someone), containsString(someone));
25 | }
26 |
27 | @Test
28 | public void greetShouldIncludeGreetingPhrase() {
29 | String someone = "World";
30 |
31 | assertThat(greeter.greet(someone).length(), is(greaterThan(someone.length())));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/ScriptedPipeline_Jenkinsfile.txt:
--------------------------------------------------------------------------------
1 | node('master')
2 | {
3 | stage('ContinuousDownload')
4 | {
5 | git 'https://github.com/selenium-saikrishna/maven.git'
6 | }
7 | stage('ContinuousBuild')
8 | {
9 | sh 'mvn package'
10 | }
11 | stage('ContinuousDeployment')
12 | {
13 | sh 'scp /var/lib/jenkins/workspace/Pipeline/webapp/target/webapp.war vagrant@10.10.10.32:/var/lib/tomcat7/webapps/qaenv.war'
14 | }
15 | stage('ContinuousTesting')
16 | {
17 | git 'https://github.com/selenium-saikrishna/TestingOnLinux.git'
18 | sh 'java -jar /var/lib/jenkins/workspace/Pipeline/testing.jar'
19 | }
20 | stage('ContinuousDelivery')
21 | {
22 | input message: 'Waiting for approval from DM', submitter: 'Srinivas'
23 | sh 'scp /var/lib/jenkins/workspace/Pipeline/webapp/target/webapp.war vagrant@10.10.10.33:/var/lib/tomcat7/webapps/prodenv.war'
24 | }
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/webapp/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 |
7 | com.example.maven-project
8 | maven-project
9 | 1.0-SNAPSHOT
10 | ../pom.xml
11 |
12 |
13 | webapp
14 | war
15 | Webapp
16 | Webapp.
17 |
18 |
19 | ${project.artifactId}
20 |
21 |
22 |
23 | org.mortbay.jetty
24 | jetty-maven-plugin
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | javax.servlet
33 | servlet-api
34 | provided
35 |
36 |
37 |
38 | javax.servlet.jsp
39 | jsp-api
40 | provided
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/server/pom.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 | 4.0.0
5 |
6 |
7 | com.example.maven-project
8 | maven-project
9 | 1.0-SNAPSHOT
10 | ../pom.xml
11 |
12 |
13 | server
14 | jar
15 | Server
16 | Logic.
17 |
18 |
19 | ${project.artifactId}
20 |
21 |
22 |
23 |
24 | junit
25 | junit-dep
26 | test
27 |
28 |
29 |
30 | org.hamcrest
31 | hamcrest-core
32 | test
33 |
34 |
35 |
36 | org.hamcrest
37 | hamcrest-library
38 | test
39 |
40 |
41 |
42 | org.mockito
43 | mockito-core
44 | test
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/DeclarativePipeline_Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline
2 | {
3 | agent any
4 | stages
5 | {
6 | stage('ContDownload')
7 | {
8 | steps
9 | {
10 | git 'https://github.com/selenium-saikrishna/maven.git'
11 | }
12 | }
13 | stage('ContBuild')
14 | {
15 | steps
16 | {
17 | sh 'mvn package'
18 | }
19 | }
20 | stage('ContDeployment')
21 | {
22 | steps
23 | {
24 | sh 'scp /var/lib/jenkins/workspace/Declarative_Pipeline/webapp/target/webapp.war vagrant@10.10.10.32:/var/lib/tomcat7/webapps/qaenv.war'
25 | }
26 | }
27 | stage('ContTesting')
28 | {
29 | steps
30 | {
31 | git 'https://github.com/selenium-saikrishna/TestingOnLinux.git'
32 | sh 'java -jar /var/lib/jenkins/workspace/Declarative_Pipeline/testing.jar'
33 | }
34 | }
35 | }
36 | post
37 | {
38 | success
39 | {
40 | input message: 'Waiting for approval from DM', submitter: 'Srinivas'
41 | sh 'scp /var/lib/jenkins/workspace/Declarative_Pipeline/webapp/target/webapp.war vagrant@10.10.10.33:/var/lib/tomcat7/webapps/prodenv.war'
42 | }
43 | failure
44 | {
45 | mail bcc: '', body: '', cc: '', from: '', replyTo: '', subject: 'Build failed', to: 'gandham.saikrishna@gmail.com'
46 |
47 | }
48 |
49 | }
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 | 4.0.0
10 |
11 | com.example.maven-project
12 | maven-project
13 | pom
14 | 1.0-SNAPSHOT
15 | Maven Project
16 | Sample Maven project with a working, deployable site.
17 | http://www.example.com
18 |
19 |
20 | utf-8
21 | utf-8
22 |
23 |
24 |
25 | server
26 | webapp
27 |
28 |
29 |
30 |
31 | site-server
32 | Test Project Site
33 | file:///tmp/maven-project-site
34 |
35 |
36 |
37 |
38 |
39 |
40 | maven-compiler-plugin
41 |
42 | 17
43 | 17
44 |
45 |
46 |
47 |
48 | maven-release-plugin
49 |
50 | true
51 |
52 |
53 |
54 |
55 | maven-site-plugin
56 |
57 |
58 |
59 | maven-checkstyle-plugin
60 |
61 |
62 |
63 | maven-jxr-plugin
64 |
65 |
66 |
67 | maven-javadoc-plugin
68 |
69 |
70 |
71 | maven-pmd-plugin
72 |
73 |
74 |
75 | maven-surefire-report-plugin
76 |
77 |
78 |
79 | org.codehaus.mojo
80 | findbugs-maven-plugin
81 |
82 |
83 |
84 | org.codehaus.mojo
85 | taglist-maven-plugin
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | maven-checkstyle-plugin
96 | 2.8
97 |
98 |
99 |
100 | maven-compiler-plugin
101 | 2.3.2
102 |
103 |
104 |
105 | maven-javadoc-plugin
106 | 2.8
107 |
108 |
109 |
110 | maven-jxr-plugin
111 | 2.3
112 |
113 |
114 |
115 | maven-pmd-plugin
116 | 2.6
117 |
118 |
119 |
120 | maven-project-info-reports-plugin
121 | 2.4
122 |
123 |
124 |
125 | maven-release-plugin
126 | 2.2.1
127 |
128 |
129 |
130 | maven-resources-plugin
131 | 2.5
132 |
133 |
134 |
135 | maven-site-plugin
136 | 3.0
137 |
138 |
139 |
140 | maven-surefire-report-plugin
141 | 2.11
142 |
143 |
144 |
145 | maven-surefire-plugin
146 | 2.11
147 |
148 |
149 |
150 | org.codehaus.mojo
151 | findbugs-maven-plugin
152 | 2.3.3
153 |
154 |
155 |
156 | org.codehaus.mojo
157 | taglist-maven-plugin
158 | 2.4
159 |
160 |
161 |
162 | org.mortbay.jetty
163 | jetty-maven-plugin
164 | 8.0.0.M1
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 | javax.servlet
174 | servlet-api
175 | 2.5
176 |
177 |
178 |
179 | javax.servlet.jsp
180 | jsp-api
181 | 2.2
182 |
183 |
184 |
185 | junit
186 | junit-dep
187 | 4.10
188 | test
189 |
190 |
191 |
192 | org.hamcrest
193 | hamcrest-core
194 | 1.2.1
195 | test
196 |
197 |
198 |
199 | org.hamcrest
200 | hamcrest-library
201 | 1.2.1
202 | test
203 |
204 |
205 |
206 | org.mockito
207 | mockito-core
208 | 1.8.5
209 | test
210 |
211 |
212 |
213 |
214 |
215 | scm:git:git@github.com:jleetutorial/maven-project.git
216 | scm:git:git@github.com:jleetutorial/maven-project.git
217 | HEAD
218 | http://github.com/jleetutorial/maven-project
219 |
220 |
221 |
222 | 3.0.3
223 |
224 |
225 |
226 |
--------------------------------------------------------------------------------