enforcing maven 3 - when to use maven enforcer plugin? when to use pom prerequisites element?

后端 未结 2 971
旧巷少年郎
旧巷少年郎 2021-02-13 11:40

The two main approaches for enforcing maven 3 seem to be:

  • maven-enforcer-plugin, and
  • pom.xml element.

2条回答
  •  醉酒成梦
    2021-02-13 12:11

    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.

提交回复
热议问题