Maven contd..
- Maven Parent POM (Super POM) is used to structure the project to avoid duplicate configurations
- When developing a complex project we might create multiple sub projects
- In the parent pom we would be mentioning the packaging type as pom

- In the child pom you would specify the parent structure

- Now to build this project all the childs will be built
- In the parent pom we would be mentioning the packaging type as pom
- Now lets integrate maven to run on jenkins server

- The job fails as maven is not installed on this machine

- Now install maven on the server where jenkins is installed
sudo apt install maven -y
Jenkins Free Style Project
- Free Style is a legacy jenkins project type.
- This project has six sections
- General:
- This section has basic description about project
- Source Code Management:
- This section defines the source code management or version control of the project code
- By default jenkins will have git plugin installed, so we will see two options none and Git.
- If you require other VCS systems
- install vcs on the node
- install vcs plugin on jenkins ui
- Build Triggers:
- Basically focused on when to build a project
- Build Environment
- Build
- Post Build Actions

- General:
- Lets try to create a jenkins free style project to build spring petclinic
- every time developer submits the code to git
- Show the test results
- Give an option to download the package
- Solution:
- Try to fork spring petclinic from Refer Here to your account
- Create a free style project with any name

- Now specify the git source code details

- Now lets go to the build section and use invoke top level maven targets

- Now lets navigate to the build triggers section and use poll scm

- Now lets save the project and create a dummy push in the github repo

- Now the build will be triggered

- Now lets configure this project to show the unit test results. Navigate to Post build actions => Publish Junit test results

- Now build the project and observe the project page after build is finished

- Now lets give an option to show the projects primary artifact (project packaging format). Navigate to Post Build actions => Archive the artifacts

- Now save and build the project

Configuring Jenkins
- In this section we will learn some basic jenkins administration tasks
- Jenkins Plugin Management
- User Management in Jenkins
- Performing backup/restore in Jenkins
Jenkins Plugin Manager
- Jenkins plugins are pieces of software that upon installation will enhance the jenkins functionality
- To view the Jenkins Plugins

- To install the plugin navigate to available section and search for plugins and install them
- Manually Installing a Jenkins Plugin
- Jenkins plugin will be in the format of .hpi (hudson plugin interface) or .jpi(jenkins plugin interface)
- Plugin might require jenkins restart to work. Jenkins Plugin adds the functionality.
- Plugins might add functionality in the
- Jenkins Job Configurations
- Jenkins Management Configurations
Jenkins Backup and Restore
- In Jenkins all the configuration is stored in Jenkins Home directory.
- If we want to backup jenkins just take the backup of Jenkins home directory
- We can apply various approaches for taking the backup of jenkins home directory (/var/lib/jenkins)
- write a cron job to take the backup of jenkins periodically
- Use rsync
- Use Jenkins Periodic Backup Plugin
- Install Jenkins periodic backup plugin

- Navigate to Manage Jenkins => Periodic Backup Manager

- Now configure the settings and create backup
- Once backups are available, we can restore from backups
