gpt4 book ai didi

java - 是否有必要在 pom 中指定 maven 插件的版本?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:47:20 24 4
gpt4 key购买 nike

我正在使用 NetBeans 进行开发,它具有内置菜单功能,允许我们添加 maven-checkstyle-plugin在 pom 中进行代码格式化。但是,当您单击该菜单时,它会自动在 pom 中添加以下代码,但没有 <version>信息。现在我的 IDE 一直在提示,在页边空白处有一条小提示消息说“版本”标签丢失了。我的问题是:是否所有添加的插件都必须有 <version> pom 中的标签?

pom.xml

 <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>

最佳答案

这不是必须的,但强烈建议使用版本标签。

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. For the sake of stability, Maven 3.x prefers the latest release version over the latest snapshot version.

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.

https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes

关于java - 是否有必要在 pom 中指定 maven 插件的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22621252/

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