Maven used for build automation and Jenkins for continuous integration and delivery (CI/CD). Maven efficiently manages project dependencies, compiles the source code, and packages the application, while Jenkins automates the entire pipeline—from code integration and testing to deployment. By combining Maven’s build capabilities with Jenkins’ automation, the project ensures faster releases, consistent builds, and minimal manual effort, enhancing overall productivity and reliability.
- Maven
- Automates build and packaging of the application.
- Manages dependencies efficiently.
- Ensures consistent builds across different environments.
- Jenkins
- Automates the CI/CD pipeline for integration, testing, and deployment.
- Detects and addresses code issues early.
- Reduces manual effort and speeds up releases.
- In short:
- Maven handles the build side, and Jenkins handles the automation, making the Student App deployment faster, more reliable, and consistent.
To deploy the Student Application by integrating Maven for efficient build and dependency management with Jenkins for automated CI/CD, ensuring faster delivery, consistent builds, and improved reliability with minimal manual intervention.
-
Install Maven -
- command -> 'sudo apt-get install maven'
-
Check Version Of Maven -
- command -> 'mvn --version'
-
Check Version Of Java -(which is already installed)
- command -> 'java --version'
-
To Create Repository Structure -
- command -> 'mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false'
-
Go to AWS interface
- Click on 'Launch Instance'
- Give name -> 'student-app'
- Select AMI -> 'ubuntu'
- Select Key-pair -> 'jenkins' (select same key-pair which we used in jenkins server)
- Select security-group -> Same as jenkins security-group
- Click on 'Launch Instance'
-
Install Java(Java is tomcats dependency then we need to install java first)
- command -> 'sudo apt-get install openjdk-17-jdk -y'
-
Install Tomcat10
- command -> 'sudo apt-get install tomcat10 -y'
-
After installation it is necessary to start, enable tomcat10 and check status of tomcat10
- command-> 'sudo systemctl start tomcat10'
- command->'sudo systemctl enable tomcat10'
- command->'sudo systemctl status tomcat10'
-
Go to browser and Check tomcat10 page
-
Go to jenkins interface
- Click on 'Setting'
- Click on 'Credential'
- Click on 'Global'
- Click on 'Add Credential'
- Select Kind -> 'SSH Username With pvt key'
- Select scope -> 'Global'
- Give ID -> 'student-app-id'
- Give Username -> 'ubuntu'
-
Go to jenkins server to copy jenkins.pem key because for creating credential we want jenkins.pem key
- command -> 'cat jenkins.pem'
-
Go to Jenkins interface and paste key into enter directly
- Click on 'Enter directly'
- Click on 'Create'
-
Click on 'New Item'
-
Click on 'Pipeline'
-
Click on 'ok'
-
Click on 'github webhook' (we select this webhook option because we have to automate project using webhook)
-
Click on 'Ok'
-
Click on 'student-app-deployment'
-
Click on 'source code management (SCM)'
-
Click on 'git'
-
Give Student-app repo URL
-
Branch -> 'master'
-
Scriptpath -> 'jenkinsfile'
-
Click on 'Save'
-
Go to github
- Click on 'repository'
- Click on 'Webhook'
- Click on 'add webhook'
- Type URL - http://jenkins server public ip:8080/github-webhook/
- Click on 'Add webhook