The two main approaches for enforcing maven 3 seem to be:
element.
Prerequisites are deprecated, and you should use the enforcer plugin. MNG-5297 requests a documentation update to clarify this.
The maven-enforcer-plugin
FAQ explains the difference:
Why can't I just use the prerequisites tag in the pom?
The prerequisites tag was designed to be used by tools like plugins. It will work for regular projects, but it isn't inherited to their children. If it is set in a parent reactor, then Maven will do the check. However if one of the children are built, the check is not performed. The enforcer plugin is designed to allow centralized control over the build environment from a single "super-pom", and to allow greater flexibility in version specification by supporting ranges.
In addition, note that prerequisites do not work with Maven 3.
The Maven pom prerequisites
approach may be more appropriate for smaller, simpler projects. This approach will be lighter weight as it will not require the maven-enforcer-plugin
to be downloaded.
The maven-enforcer-plugin
approach may be more suitable if you have children projects that you wish to inherit the maven 3 requirement from the parent. pom prerequisites
is not inherited by children projects.