651.288.7000 info@intertech.com

This DevOps Tutorial is Part 4 of my series on Java Project Versioning. Check out the other articles:

At this point in time I assume you have Jenkins installed and ready to use.  If this is not the case you can follow Jenkins Tutorial – Install Jenkins in order to get everything setup.

For those of you who are not familiar with Continuous Integration, the idea is fully build and test every time a change to the source code is pushed to the Source Code Management (SCM) server.  This allows for very early detection of integration problems, and defects.

Let us start by making Jenkins check out our source code, and build it using Maven.

Go to the web interface for your Jenkins install.  Mine is at http://quartz:8080/jenkins/.  You should see the following in the middle of the page.  Click the “create new jobs” link.

DevOps Tutorial a1

Provide “SampleWebApp123” as the item name and select “Maven Project”.

DevOps Tutorial a2

Now we need to setup the connection between Jenkins and Git, however Jenkins does not support Git out of the box so we are going to install a plugin.  Go back to the Jenkins homepage http://quartz:8080/jenkins/ and click on Manage Jenkins.

DevOps Tutorial a3

Select Manage Plugins.

DevOps Tutorial a4

Click on Available and search for “Git”.

DevOps Tutorial a5


Scroll down to find the “Git Plugin”, check the checkbox and click “Install without restart”.


DevOps Tutorial a6

Go back to the Jenkins Homepage http://quartz:8080/jenkins and click on the name of your project.

DevOps Tutorial a7

Click configure on the left side.

DevOps Tutorial a8

At this point in the DevOps Tutorial you need to have git and maven installed on your development server.  If they are not installed, installation is as simple as:

$ sudo yum install git

$ sudo yum install maven

Fill in the appropriate values in the “Source Code Management” portion of the configuration, and click save.  If the repository URL is on the same machine, and the hostname is not set by DNS, then you might have to add your hostname to the first line of the file /etc/hosts file such as “  localhost localhost.localdomain quartz”

It is best to use the http access to your git repository, setting up ssh access requires configuring your keys which is beyond the scope of this article.

DevOps Tutorial a9

Scroll to the maven configuration section and fill out as this shows, or as matches your system, and save the configuration.

DevOps Tutorial a10

You can now perform a build of your project by returning to the Jenkins homepage and clicking the “Schedule a build” icon as shown below.

DevOps Tutorial a11

Next we need to install the Maven Release Plug-in Plug-in.  Install this plug-in the same way the Git plugin was installed.

In order to save the Git and Nexus credentials, we need to add the Config File Provider Plugin the same way the Git and Maven Release Plug-ins were installed.  Then go to “Manage Jenkins” -> “Managed files” -> “Add a new Config” and select “Maven settings.xml”.

DevOps Tutorial a12

Add credentials for Git and Nexus as shown below.

DevOps Tutorial a13

Now that the credentials are stored in the config file, configure the Jenkins job to use this file.  Go to the “Build Environment” section and check the “Provide Configuration files” box and select the file you just created.

DevOps Tutorial a14

Now you can use Jenkins to perform a release and store it in Nexus.  Click on “Perform Maven Release” in the job menu.

DevOps Tutorial a15

Now you can enter the version number you wish to release.

DevOps Tutorial a16

At this point in the DevOps Tutorial you have a complete build pipeline to produce consistent releases.  Each commit will be built, tested, and stored in Nexus.