Developers, Developers, Developers! Maksim Sorokin IT Blog

18Aug/100

Providing Build Information Automatically for Every Maven Project

This article describes a possibility to automatically inject properties file with build information into any Maven module.

Sometimes you need to provide version and build information in "About" dialog of the application. You can easily create a simple properties file in your resources folder and apply filtering on it, where build version and timestamp would be automatically replaced on each maven build. But what to do when you have dozen of such project? Is there a way to do this automatically? Indeed, there is.

The idea is simple. We start by creating a Maven "template" project which would just hold a general build properties file. Then we create a parent project which would know how to intervene into a build cycle and inject build properties file. Then we simply inherit this parent project in all other projects which require such automatic build numbering injection.

As an example we will only

14Aug/100

Maven Versioning Problems Having Different Purpose Modules Under One Parent

If you have modules with different purpose, you eventually hit the versioning problem.

When you change only one module and want to make a release, usually you go for parent project release, since otherwise there will be a mess having modules with different numbers. But another module was not changed! But the versioning number was increased.

Here is live example. You have a maven project. Then, you introduce an

7Feb/100

Product Versioning With Maven

Each mavenized project has its own version. Sometimes it is useful to have access to the project version from the code. For instance, display project version in the about box or on the info page.

Here is the way to do that.