diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..70bbaa2ec --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,28 @@ +pipeline { + agent any + stages { + stage('checkout') { + steps { + sh 'rm -rf hello-world-war' + sh 'git clone https://github.com/Kavana147/hello-world-war.git' + } + } + stage('build') { + steps { + dir('hello-world-war') { + sh 'mvn package' + } + } + } + stage('deploy') { + steps { + sh 'sudo cp -r /var/lib/jenkins/workspace/Multipipeline_pipeline2/hello-world-war/target/hello-world-war-1.0.0.war /opt/apache-tomcat-9.0.64/webapps/' + sh 'sudo sh /opt/apache-tomcat-9.0.64/bin/shutdown.sh' + sh 'sudo sh /opt/apache-tomcat-9.0.64/bin/startup.sh' + sh 'echo "Successfully deployed"' + } + + } + } + +} diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index ead0e510f..7a4ead12a 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -1,13 +1,15 @@
-It is now <%= new java.util.Date() %>
You are coming from <%= request.getRemoteAddr() %>
- \ No newline at end of file + +