[英]Is it necessary to specify version of a maven plugin in pom?
I am using NetBeans for development and it has built-in menu feature that allows us to add maven-checkstyle-plugin
in the pom for code formatting . 我正在使用NetBeans进行开发,它具有内置菜单功能,允许我们在pom中添加
maven-checkstyle-plugin
以进行代码格式化。 However, when you click on that menu it add the following piece of code in the pom automatically but without the <version>
information. 但是,当您单击该菜单时,它会自动在pom中添加以下代码,但不包含
<version>
信息。 Now my IDE keeps on complaining with a small hint message in the margin saying that the 'version' tag is missing. 现在我的IDE继续抱怨边缘的一条小提示消息,说“版本”标签丢失了。 My question is: Does all plugins added has to have a
<version>
tag in the pom? 我的问题是:添加的所有插件是否都必须在pom中有
<version>
标签?
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
It is not necessary, but highly recommended to use the version tag. 没有必要,但强烈建议使用版本标签。
When a plugin was invoked without an explicit version given in the POM or on the command line, Maven 2.x used to pick the latest version available where the latest version could either be a release or a snapshot.
当在没有POM或命令行中给出的显式版本的情况下调用插件时,Maven 2.x用于选择最新版本可用的最新版本,其中最新版本可以是版本或快照。 For the sake of stability, Maven 3.x prefers the latest release version over the latest snapshot version.
为了稳定起见,Maven 3.x更喜欢最新版本的最新版本。
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.
鉴于自动插件版本解析所施加的不可重现构建的威胁,就POM中的插件声明而言,此功能计划被删除。 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.
当检测到缺少插件版本时,Maven 3.x的用户会发现它会输出警告,以鼓励向POM或其父POM添加插件版本。 The Enforcer rule requirePluginVersions can be used additionally check for missing plugin versions in the POM.
可以使用Enforcer规则requirePluginVersions来检查POM中缺少的插件版本。
https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.