651.288.7000 info@intertech.com

In this five part DevOps tutorial series I will explain how to manage your project versioning using Maven, versioning best practices, and integration versioning into a build process.

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

For this Dev Ops tutorial series I assume that you have a Tomcat 7 server setup and available. If you do not have a Tomcat 7 server available for your testing, check out my “Lightning Tutorial – Installing Tomcat 7”.

To start things out we need to create a basic webapp project. Open up a command line and execute the following command. A project will be created using Maven’s webapp archetype. For more information on archetypes go to: https://maven.apache.org/guides/introduction/introduction-to-archetypes.html

Next we need to make a few modifications to the project’s pom.xml file.

1. Modify the finalName element to match the following line. The ## characters allows Tomcat to determine both the name of the webapp and the version. This will be used later in this series to run two versions of our webapp at the same time.


2. Add deploy plugin under the build tag. You will need to change the highlighted sections to match your configuration.


3. Create a properties file at src/main/resources/test.properties with the following content. We will use resource filtering to insert the version from the pom.xml into this properties file.


4. Add filtering of resources. This replaces ${project.version} in the properties file you just created with the version from the pom.xml. This properties file can then be accessed by the jsp pages we are about to modify to display the version of this web app. For more information on resource filtering go to http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html


Now we can edit index.jsp to display the version from the properties file. Include the following code in your src/main/webapp/index.jsp.


Let’s build and deploy our sample web app


Check out the results in your browser (again replacing the highlighted text for your configuration). Go to http://quartz:8080/SampleWebApp123

You should see:

Hello World!



The next article in this DevOps tutorial series will explore how to have maven manage the version numbers without you having to manually edit the pom.xml to change the version.

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

Pin It on Pinterest

Share This

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!