All_docs
All_docs
GITHUB EXERCISES
MAVEN JAVA PROJECT AND PUSHING IT TO GITHUB
Step 1) Go to file->new click maven project and write name and select archetype.
Step 2) Write Group and Artifact ID, wait till you get Build Success, then run as Maven Clean
Step 3) You will get Build Success, after that click Run as-> Maven Test and wait for Build success
Step 4) Now Select Run as -> Maven build and wait for Build Success, then again select
Step 8: Give right click on your project -> click on Run as -> Click on Maven Clean
Step 9: Give right click on your project -> click on Run as -> Click on Maven Install
Step 10: Give right click on your project -> click on Run as -> Click on Maven Test
Step 11: Give right click on your project -> click on Run as -> Click on Maven Build -> Write all the
steps What you did till now in Goals ->Apply -> Run
Step 12: Click on Servers -> There You find Tomcat Server if not Install it -> Initially it is in Stop Stage.
So, Right Click on it ->Click on Start
Step 13: Give right click on your project -> click on Run as -> Click on Run on the Server -> Select
Tomcat and Finish
Step 14: Done, you can see Your Web page on any default Browser
JENKINS 2 PIPELINE
Step 1: Go to Dashboard->New Item. Then enter project name as java_build, select free style project.
Step 2: In source code management select git and paste github repository where java project is
present.
Step 3: Check branch specifier is */main or not. If not update to */main.
Step 4: In build steps, click on Add build step and select “Invoke top-level maven targets”. In that
select maven version as MAVEN_HOME and enter goals as “clean install”.
Step 5: In post-build actions click on add post build actions and select “archieve the artifacts” and
enter files to archieve as “**/*”. Again, click on add post build actions and select “Build other
projects”. Then enter the project name as “java test” and then click on apply and save.
Step 6: Again, go to dashboard click on new item and project name as “java test” and select as
freestyle project. Then click on OK.
Step 7: In build environment select “delete workspace before build starts”.
Step 8: In build steps click on add build step and select “copy artifacts from other projects”.
Step 12: In select initial job make sure that pipeline starts from “java build”.
Step 13: Click on run button.
JENKINS 3 PIPELINE
Step 1: Go to Dashboard->New Item. Then enter project name as mavenbuild, select freestyle
project. Then click on OK.
Step 2: In source code management select git and paste github repository where web project is
present.
Step 3: Check branch specifier is */main or not. If not update to */main.
Step 4: In build steps, click on Add build step and select “Invoke top-level maven targets”. In that
select maven version as MAVEN_HOME and enter goals as “clean install”.
Step 5: In post build actions click on add post build actions and select “archieve the srtifacts” and
enter files to archieve as “**/*”. Again, click on add post build actions and select “Build other
projects”. Then enter the project name as “maventest” and then click on apply and save.
Step 6: Again, go to dashboard click on new item and project name as “maventest” and select as
freestyle project. Then click on OK.
Step 7: In build environment select “delete workspace before build starts”.
Step 8: In build steps click on add build step and select “copy artifacts from other projects”.
Step 10: In post-build actions click on add post build actions and select “archieve the srtifacts” and
enter files to archieve as “**/*”. Again, click on add post build actions and select “Build other
projects”. Then enter the project name as “mavendeploy” and then click on apply and save.
Step 11: Again, go to dashboard click on new item and project name as “mavendeploy” and select as
freestyle project. Then click on OK.
Step 12: In build steps click on add build step and select “copy artifacts from other projects”.
In containers select tomcat 9 and give tomcat url. Then click on apply and save.
Step 16: In select initial job make sure that pipeline starts from “mavenbuild”.
Step 17: Click on run button.
Step 2: Write the Jenkins script. Then click apply and save.
Step 3: Click on build now.
Change directory to “docker-compose” by using cd command. Create sample docker file “app.js”
using vi command.
Step 2 : app.js is opened and statement is written, save and come back to git bash using :wq
command.
Step 8 : By clicking on the run symbol on myimage -> Run a new container -> Select run.
Step 9 : Container is created.