未指定Maven插件版本 [英] Maven plugin version not specified

查看:1358
本文介绍了未指定Maven插件版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注意到插件的版本在maven中是可选的。我仍然可以构建我的模块而不指定它。让我们以maven-bundle-plugin为例。

I have just noticed that plugin's version is optional in maven. I can still build my module without specifying it. Let's take an example with maven-bundle-plugin.

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    ....
</plugin>

我写了一个简单的pom.xml,没有父母试试这个,所以不涉及pluginManagement 。我还检查了maven-model-builder中的超级超级pom-4.0.0.xml,以确认maven-bundle-plugin不存在。此插件版本未在任何地方指定。

I have written a simple pom.xml without a parent to try this out, so pluginManagement is not involved. I have also checked the super super pom-4.0.0.xml in maven-model-builder to confirm that maven-bundle-plugin isn't there. This plugin version is not specified anywhere.

maven如何确定要采用的版本?

How does maven determine which version to take?

推荐答案

来自 Maven 3.x兼容性说明


自动插件版本解析



当a在没有POM
或命令行中给出的显式版本的情况下调用插件,Maven 2.x用于选择最新版本
,其中最新版本可以是发行版或
快照。 为了稳定起见,Maven 3.x比最新的快照版本更喜欢最新的
发布版本。

鉴于威胁由自动插件版本
分辨率强加的
不可重现的版本,就POM中的插件
声明而言,此功能计划被删除。当检测到丢失的插件版本为
时,Maven 3.x的用户会发现
输出警告鼓励向POM或其
父POM之一添加插件版本。可以使用Enforcer规则requirePluginVersions
另外检查POM中是否缺少插件版本。

Given the threat of non-reproducible builds imposed by automatic plugin version resolution, this feature is scheduled for removal as far as plugin declarations in the POM are concerned. Users of Maven 3.x will find it output a warning when missing plugin versions are detected to encourage the addition of plugin versions to the POM or one of its parent POMs. The Enforcer rule requirePluginVersions can be used additionally check for missing plugin versions in the POM.

这篇关于未指定Maven插件版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆