gpt4 book ai didi

maven-2 - Maven 插件更新

转载 作者:行者123 更新时间:2023-12-03 19:01:12 26 4
gpt4 key购买 nike

是否有自动跟踪 maven 插件版本更新的机制。由于大多数时候在dependencyManagement 中,您对每个插件的版本号进行了硬连线。是否有管理命令来查找有关 pom.xml 中声明的插件可用的较新版本的信息?

最佳答案

Versions Maven Plugin有一个不错的 versions:display-plugin-updates 为此,魔力。
要使用它,只需运行:

mvn versions:display-plugin-updates

这会产生类似的东西:
[INFO] ------------------------------------------------------------------------[INFO] Building sandbox[INFO]    task-segment: [versions:display-plugin-updates][INFO] ------------------------------------------------------------------------[INFO] [versions:display-plugin-updates {execution: default-cli}][INFO] [INFO] The following plugin updates are available:[INFO]   maven-clean-plugin ....................................... 2.2 -> 2.4[INFO]   maven-compiler-plugin .................................. 2.0.2 -> 2.1[INFO]   maven-deploy-plugin ...................................... 2.4 -> 2.5[INFO]   maven-install-plugin ..................................... 2.2 -> 2.3[INFO]   maven-jar-plugin ......................................... 2.2 -> 2.3[INFO]   maven-resources-plugin ................................. 2.3 -> 2.4.1[INFO]   maven-site-plugin ................................. 2.0-beta-7 -> 2.1[INFO]   maven-surefire-plugin .................................. 2.4.3 -> 2.5[INFO] [INFO] All plugins have a version specified.[INFO] [INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 7 seconds[INFO] Finished at: Fri Jan 22 07:21:57 CET 2010[INFO] Final Memory: 16M/68M[INFO] ------------------------------------------------------------------------

It will also warn you if you have not specified the versions of plugins that you are using. See Checking for new plugin updates for details.

Update: (answering some additional questions posted as comments)

How does it decide to figure out the list of plugins to search for (is it from pluginManagement?)

AFAIK, the plugin should scan all plugins i.e. build.plugins, build.pluginManagement.plugins and build.reporting.plugins (see MVERSIONS-83 about this).

I did a quick check on build/pluginManagement/plugins and it looks like didn't find updates for plugins other than org.apache.maven.plugins

I did a test too and this is not what I'm observing. At least it works with mojos from codehaus (like in the last sample from the previous link). But if I move the plugin in build.plugins, it doesn't work indeed. This is actually a bug, see MVERSIONS-69. Surprisingly, it seems to work with the version 1.1 that you can run as shown below:

mvn org.codehaus.mojo:versions-maven-plugin:1.1:display-plugin-updates

如果你仔细看 MVERSIONS-69 ,集成测试的输出表明它应该适用于任何插件。但我承认,我不是 100% 确定。

关于maven-2 - Maven 插件更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2115328/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com