Saturday, 25 May 2013

Exposing the version of your Maven built web application

Sometimes its useful to expose the version of your web application - I find it useful so vsConsole can display the version of the deployed application for each environment on the dashboard. If you build your app with Maven, you can use this code to get the version, and simply wire up a controller/rest endpoint to return it as text/plain. To expose the version of your maven built spring web application, you can use a REST controller like that shown below. Note, you won't see a valid version while running in the IDE - it'll only work when running the Maven built WAR. If you want to add the Jersey dependencies to your spring application try using the following dependency declaration.