DevOps Classroomnotes 18/Jul/2023

Using Jenkins to build Maven Projects

Jenkins configuration

  • Install jenkins
    • jdk 17
  • Install and configure maven in Jenkins (Master Node)
  • Lets build spring petclinic Refer Here
    • software requirements
      • jdk 17
      • maven
  • Create a free style project to build spring petclinic
    Preview
    Preview
  • Free style project sections
    Preview
  • General: This represents the project information
    Preview
  • Source Code Managent: This represent the code to be used for ci/cd pipelines
    Preview
  • Build Triggers: This represent when to build
    • Build Periodically: If the project has to be build based on schedule, write cron expression into this Refer Here
    • Poll SCM: this represents jenkins polling scm (asking git) and the cron expression represents how frequently should it ask
      Preview
  • Build Environment: This represents the environmental configuration
    Preview
  • Build Steps: These are actual activities that are performed during execution.
    Preview
    Preview
  • Post Build actions: Actions to be performed after completion of build
    Preview
    Preview
  • Now we can wait for the trigger to call the job or trigger build manually
    Preview
  • In Jenkins we can have multiple versions of java, maven etc and we can handle these by configuring jenkins
  • To fix the maven 3.6.3 issue we had install 3.9 and used full path for package
    Preview
    Preview
  • Test results
    Preview

Jenkins Terms

  • Jenkins Home: Jenkins home is a folder where jenkins stores all of is configuration. In the above case the workspace is /var/lib/jenkins. If you want to change the workspace deal with JENKINS_HOME
  • Backup of Jenkins is backup of Workspace
  • Project: This contains the actvity that needs to be performed on triggers.
    • This project is stored as xml file in workspace
    • Types:
      • Freestyle project: This is UI based configuration
      • Pipeline: This is instructions expressed in some code format.
  • Build: This represents the execution of project. Every build for a project has a running number called as Build id
  • Node: This represents the machine on which build can be executed.
  • Each Node can be configured to handle multiple builds by executors.
    Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner