如何升级maven插件的版本?

发布于 2024-07-17 12:14:13 字数 208 浏览 4 评论 0原文

我正在使用 maven-ear-plugin 版本 2.3.1 - 我知道有一个新版本可用: http://maven.apache.org/plugins/maven-ear-plugin/

我不知道如何升级到最新版本?

I am using the maven-ear-plugin version 2.3.1 - I know there is a new version available: http://maven.apache.org/plugins/maven-ear-plugin/

I can't work out how to upgrade to the latest version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

如日中天 2024-07-24 12:14:13

尽管这已经得到了“批准的答案”,但事实证明,有这个 AWESOME versions 插件 处理无休止的版本维护问题。

对于那些懒惰的人来说,这里有一些目标:

  • versions:display-dependency-updates 扫描项目的依赖项并生成具有可用更新版本的依赖项的报告。
  • versions:display-plugin-updates 扫描项目的插件并生成具有可用更新版本的插件的报告。
  • versions:display-property-updates 扫描项目并生成用于控制工件版本以及哪些属性具有可用更新版本的属性的报告。
  • versions:update-parent 更新项目的父部分,以便它引用最新的可用版本。 例如,如果您使用公司根 POM,并且需要确保使用最新版本的公司根 POM,则此目标会很有帮助。
  • versions:update-properties 更新项目中定义的属性,以便它们对应于特定依赖项的最新可用版本。 如果一组依赖项必须全部锁定到一个版本,这会很有用。
  • versions:update-child-modules 更新项目子模块的父部分,以便版本与当前项目的版本匹配。 例如,如果您有一个聚合器 pom,它也是它聚合的项目的父级,并且子级和父级版本不同步,则此魔力可以帮助修复子模块的版本。 (请注意,如果您的项目严重损坏,由于版本不匹配而无法构建,您可能需要使用 -N 选项调用 Maven 才能运行此目标)。
  • versions:lock-snapshots 在 pom 中搜索所有 -SNAPSHOT 版本,并将其替换为该 -SNAPSHOT 的当前时间戳版本,例如 -20090327.172306-4
  • versions:unlock-snapshots在 pom 中搜索所有时间戳锁定的快照版本,并将其替换为 -SNAPSHOT。
  • versions:set 可用于从命令行设置项目版本。
  • versions:use-releases 在 pom 中搜索所有已发布的 -SNAPSHOT 版本,并将其替换为相应的发布版本。
  • versions:use-next-releases 在 pom 中搜索所有较新版本的非 SNAPSHOT 版本,并将其替换为下一个版本。
  • versions:use-latest-releases 在 pom 中搜索所有较新版本的非 SNAPSHOT 版本,并将其替换为最新版本。
  • versions:use-next-snapshots 在 pom 中搜索所有较新的 -SNAPSHOT 版本的非 SNAPSHOT 版本,并将其替换为下一个 -SNAPSHOT 版本。
  • versions:use-latest-snapshots 在 pom 中搜索所有较新的 -SNAPSHOT 版本的非 SNAPSHOT 版本,并将其替换为最新的 -SNAPSHOT 版本。
  • versions:use-next-versions 在 pom 中搜索所有较新版本,并将其替换为下一个版本。
  • versions:use-latest-versions 在 pom 中搜索所有较新版本,并将其替换为最新版本。

Even though this has already gotten the "approved answer", it turns out that there is this AWESOME versions plugin that handles the neverending version maintenance problem.

For those lazy people here are some of its goals:

  • versions:display-dependency-updates scans a project's dependencies and produces a report of those dependencies which have newer versions available.
  • versions:display-plugin-updates scans a project's plugins and produces a report of those plugins which have newer versions available.
  • versions:display-property-updates scans a projectand produces a report of those properties which are used to control artifact versions and which properies have newer versions available.
  • versions:update-parent updates the parent section of a project so that it references the newest available version. For example, if you use a corporate root POM, this goal can be helpful if you need to ensure you are using the latest version of the corporate root POM.
  • versions:update-properties updates properties defined in a project so that they correspond to the latest available version of specific dependencies. This can be useful if a suite of dependencies must all be locked to one version.
  • versions:update-child-modules updates the parent section of the child modules of a project so the version matches the version of the current project. For example, if you have an aggregator pom that is also the parent for the projects that it aggregates and the children and parent versions get out of sync, this mojo can help fix the versions of the child modules. (Note you may need to invoke Maven with the -N option in order to run this goal if your project is broken so badly that it cannot build because of the version mis-match).
  • versions:lock-snapshots searches the pom for all -SNAPSHOT versions and replaces them with the current timestamp version of that -SNAPSHOT, e.g. -20090327.172306-4
  • versions:unlock-snapshots searches the pom for all timestamp locked snapshot versions and replaces them with -SNAPSHOT.
  • versions:set can be used to set the project version from the command line.
  • versions:use-releases searches the pom for all -SNAPSHOT versions which have been released and replaces them with the corresponding release version.
  • versions:use-next-releases searches the pom for all non-SNAPSHOT versions which have been a newer release and replaces them with the next release version.
  • versions:use-latest-releases searches the pom for all non-SNAPSHOT versions which have been a newer release and replaces them with the latest release version.
  • versions:use-next-snapshots searches the pom for all non-SNAPSHOT versions which have been a newer -SNAPSHOT version and replaces them with the next -SNAPSHOT version.
  • versions:use-latest-snapshots searches the pom for all non-SNAPSHOT versions which have been a newer -SNAPSHOT version and replaces them with the latest -SNAPSHOT version.
  • versions:use-next-versions searches the pom for all versions which have been a newer version and replaces them with the next version.
  • versions:use-latest-versions searches the pom for all versions which have been a newer version and replaces them with the latest version.
我家小可爱 2024-07-24 12:14:13

默认的插件版本继承自Super POM,您可以通过mvn help: effective-pom检查它们。

如果您想覆盖此处提供的版本,请将其添加到您的 POM 中:

<project>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.3.1</version>
      </plugin>
    </plugins>
  </build>
</project>

将版本替换为您需要的版本。

The default plugin versions are inherited from the Super POM, and you can check them with mvn help:effective-pom.

If you want to override the version provided there, add this to your POM:

<project>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.3.1</version>
      </plugin>
    </plugins>
  </build>
</project>

Replace the version with what you need.

两相知 2024-07-24 12:14:13

详细介绍了如何选择插件版本,以及有关 superpom 中插件版本的讨论 此处

实际上当前选择的答案并不完全正确。 我应该

<project>
  <build>
   <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.3.1</version>
      </plugin>
    </plugins>
   </pluginManagement>
  </build>
</project>

解释为什么这里

“常规插件部分还允许定义版本和默认配置,这就是混乱所在,在此处定义插件版本和默认配置在技术上是有效的,但我发现遵循此指南更容易理解 pom。 :

如果插件块没有定义执行(从而绑定maven在生命周期中执行某些操作),则将该块放入pluginManagment中”

How the version of a plugin is selected, along with discussion about the plugin versions in the superpom is covered in detail here.

Actually the currently selected answer isn't quite right. It should be

<project>
  <build>
   <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.3.1</version>
      </plugin>
    </plugins>
   </pluginManagement>
  </build>
</project>

I explained why here:

"The regular plugins section also allows the version and default configuration to be defined, and this is where the confusion lies. It is technically valid to define the plugin version and default configuration here, but I find it easier to grok the pom when following this guideline:

If the plugin block is not defining an execution (and thus binding maven to do something in the lifecycle), put that block in pluginManagment"

老旧海报 2024-07-24 12:14:13

一些 Maven 插件仅限于 Maven 版本。 例如,这里的项目通常使用 Maven 2.0.4,它仅限于使用 war 插件 2.0.2 - 这适用于覆盖。 然而,Maven 2.0.9 使用的 2.1-alpha 却没有 - 所以我们必须手动降级。 除非另有说明,Maven 将根据其版本尝试使用插件的最新版本。

Some maven plugins are restricted to maven versions. For example, generally projects around here use Maven 2.0.4, which is restricted to use the war plugin 2.0.2 - this works with overlays. The 2.1-alpha whatever, however, that Maven 2.0.9 uses, does not - so we had to manually downgrade. Maven, unless otherwise instructed, will attempt to use the latest version of a plugin that it can according to its version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文