Skip to content

Srushhh/student-app-using--maven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

STUDENT-APP USING MAVEN

INTRODUCTION

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.

WHY WE USE MAVEN AND JENKINS

  1. Maven
  • Automates build and packaging of the application.
  • Manages dependencies efficiently.
  • Ensures consistent builds across different environments.
  1. Jenkins
  • Automates the CI/CD pipeline for integration, testing, and deployment.
  • Detects and addresses code issues early.
  • Reduces manual effort and speeds up releases.
  1. In short:
  • Maven handles the build side, and Jenkins handles the automation, making the Student App deployment faster, more reliable, and consistent.

OBJECTIVE

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.

STEPS TO BUILD STUDENT-APP USING MAVEN AND JENKINS

STEP-1: We already setup jenkins server, but we have to install maven

  • Install Maven -

    • command -> 'sudo apt-get install maven'

    project screenshot

  • Check Version Of Maven -

    • command -> 'mvn --version'

    project screenshot

  • 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'

    project screenshot

STEP-2: Launch an EC2 Instance

  • 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'

    project screenshot

STEP-3: We have to do some manual installation- Java , Tomcat10

  • Install Java(Java is tomcats dependency then we need to install java first)

    • command -> 'sudo apt-get install openjdk-17-jdk -y'

    project screenshot

  • Install Tomcat10

    • command -> 'sudo apt-get install tomcat10 -y'

    project screenshot

  • 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'

    project screenshot

  • Go to browser and Check tomcat10 page

    project screenshot

STEP-4: Create Credential for jenkinsfile

  • 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'

    project screenshot

  • 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'

    project screenshot

STEP-5: We have to create New Item for student-app-deployment

  • Click on 'New Item'

  • Click on 'Pipeline'

  • Click on 'ok'

    project screenshot

  • Click on 'github webhook' (we select this webhook option because we have to automate project using webhook)

  • Click on 'Ok'

    project screenshot

STEP-6: Create , Update and push jenkinsfile on github

  • command -> 'git add .'

  • command -> 'git commit -m "added jenkinsfile"'

  • command -> 'git push'

    project screenshot

STEP-7: Go to Jenkins Interface to configure student-app-deployment

  • 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'

    project screenshot

STEP-8: Now build project for console output

  • Click on 'Build now'

    project screenshot

    project screenshot

STEP-9: Add Webhook for automation

  • Go to github

    • Click on 'repository'
    • Click on 'Webhook'
    • Click on 'add webhook'
    • Type URL - http://jenkins server public ip:8080/github-webhook/

    project screenshot

    • Click on 'Add webhook

    project screenshot

STEP-10 : Do changes in jenkins file

  • Go to Jenkinsfile

  • Do some changes

  • Check changes is automatically done without clicking on build now

    project screenshot

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published