Starting with Maven 3.3.1 it is possible to define several important configuration elements within your project. For example JVM parameters or some kind of build extensions. Unfortunately using such things may result is wrong or failing builds cause those informations are not read by older Maven versions. How can you prevent such situations?
For a long time the prerequisites exists which defines the minimum Maven version to build with. I have to emphasize the build time.
One thing would be to define a prerequisites for your project which uses the new Maven 3.3.1 features like this in your pom.xml:
1 2 3 4 5 6 7 8 9 10
The problem with prerequisites is that it had been marked deprecated for a long time (starting with Maven 3.0 MNG-4840, MNG-5297, MNG-5501) and the intention of prerequisites was to prevent maven plugins running with the wrong Maven versions. I supose you are not writing a plugin but you would like to prevent people from trying to build your project with the wrong Maven version which might fail or produces weird results. So the real questions comes up. What to do?
The simple solution for this problem is the maven-enforcer-plugin. By using the following in your pom file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
you will prevent anyone from using an earlier version of Maven than 3.3.1. This solutions will also prevent Maven 2.2.1 from trying to start building such a project.
A best practice is to define such enforcer rule into the company parent pom to define the minimum Maven versions you would like to support with your builds.
The conclusion is to use the maven-enforcer-plugin rule only to define the minimum maven version to build with.