651.288.7000 info@intertech.com

This article is the second of five in my DevOps tutorial series.  In my first article I showed how you can use versioning to concurrently run two versions of a web app on Tomcat.  If you missed that part, you can check it out from the list below along with the other parts of this series.

In this installment, I’m going to run you through how to use Apache Maven to manage versions of your application.

For this article I assume you still have access to a running Tomcat instance, and a pair of browsers, but now I am adding a source code management (SCM) system to the mix.

Let’s modify our pom.xml again, this time adding the release plugin.

DevOps Tutorial 2 Image 1

Now we need to connect this project to the SCM, I’m using a GitBlit instance running on the same instance of Tomcat I’m using for testing.  If you don’t have an SCM available for testing, see my “Lightning Tutorial – Installing GitBlit”.  Add the following to your pom.xml file with the highlighted section matching your configuration.

DevOps Tutorial 2 Image 2

Next we will add credentials to your SCM server.  Add property for project.scm.id, which will reference this id in maven’s settings.xml in $MAVEN_HOME\conf.  Add the following to your pom.xml under the project tag:

DevOps Tutorial 2 Image 3

Add the following to $MAVEN_HOME\conf\settings.xml under the servers tag:

DevOps Tutorial 2 Image 4

The Maven Release Plugin is designed to store your released artifact, so we need to tell it where to put this artifact.  Add the following repository to your pom.xml, with an available directory on your system.

DevOps Tutorial 2 Image 5

Now we need to add our project to the SCM system.

DevOps Tutorial 2 Image 6

Let’s do a release

mvn release:prepare release:perform

Answer each of the questions asked during the execution of this command with the default by just pressing the “enter” key.

You will now find a war file under “C:\dev\repositories\releases\com\intertech\SampleWebApp123\1.0”.  This war can now be deployed to your tomcat instance.

The next article in this DevOps tutorial series will explain and utilize an artifact management server.

Need more DevOps help? Check out Intertech’s DevOps consulting services.


Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!

Pin It on Pinterest

Share This