如何锁定maven插件版本
如何锁定我想要使用的 Maven 插件的版本?
我的 PMD 插件配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<outputDirectory>target/pmd</outputDirectory>
<targetDirectory>target/</targetDirectory>
<aggregate>true</aggregate>
<targetJdk>1.6</targetJdk>
<rulesets>
<ruleset>rulesets/basic.xml</ruleset>
<ruleset>rulesets/codesize.xml</ruleset>
<ruleset>rulesets/coupling.xml</ruleset>
<ruleset>rulesets/design.xml</ruleset>
<ruleset>rulesets/imports.xml</ruleset>
<ruleset>rulesets/logging-java.xml</ruleset>
<ruleset>rulesets/optimizations.xml</ruleset>
<ruleset>rulesets/strings.xml</ruleset>
<ruleset>rulesets/unusedcode.xml</ruleset>
</rulesets>
</configuration>
</plugin>
昨晚,我的夜间构建失败,我无法再运行任何 pmd 目标,因为它正在尝试查找该插件的 2.6-SNAPSHOT 版本。如果我的版本标签显示为 2.5,为什么它还要尝试查找 2.6-SNAPSHOT?另外,2.6-SNAPSHOT 不在中心位置 - 为什么我的 Maven 客户端认为它存在?
Maven版本:2.0.9
Java版本:1.6.0_17
操作系统名称:“linux”版本:“2.6.24-24-generic”拱门:“i386”系列:“unix”
编辑:
我升级到maven 2.2.1并观察到与以前相同的问题。我能够通过从存储库 (.m2/repository/org/apache/maven/plugins/maven-pmd-plugin/maven-metadata-central.xml) 的元数据中删除 2.6-SNAPSHOT 来构建项目。我还将latestVersion 标签设置为2.5。这显然不是解决方案,因为我必须部署自己的插件或更改所有客户端上的缓存版本。
How can I lock the version of a Maven plugin I want to use?
I have the PMD plugin configured like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<outputDirectory>target/pmd</outputDirectory>
<targetDirectory>target/</targetDirectory>
<aggregate>true</aggregate>
<targetJdk>1.6</targetJdk>
<rulesets>
<ruleset>rulesets/basic.xml</ruleset>
<ruleset>rulesets/codesize.xml</ruleset>
<ruleset>rulesets/coupling.xml</ruleset>
<ruleset>rulesets/design.xml</ruleset>
<ruleset>rulesets/imports.xml</ruleset>
<ruleset>rulesets/logging-java.xml</ruleset>
<ruleset>rulesets/optimizations.xml</ruleset>
<ruleset>rulesets/strings.xml</ruleset>
<ruleset>rulesets/unusedcode.xml</ruleset>
</rulesets>
</configuration>
</plugin>
Last night, my nightly build failed and I can no longer run any pmd goals because it is trying to find version 2.6-SNAPSHOT of that plugin. Why is it even trying to find 2.6-SNAPSHOT if I have a version tag that says 2.5? Also, 2.6-SNAPSHOT is not in central - why does my maven client think it exists?
Maven version: 2.0.9
Java version: 1.6.0_17
OS name: "linux" version: "2.6.24-24-generic" arch: "i386" Family: "unix"
Edit:
I upgraded to maven 2.2.1 and observed the same issue as before. I was able to get the project to build by removing 2.6-SNAPSHOT from the metadata in my repository (.m2/repository/org/apache/maven/plugins/maven-pmd-plugin/maven-metadata-central.xml). I also set the latestVersion tag to 2.5. This is obviously not the solution, because I'd have to either deploy my own plugin or change the cached version on all clients.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这种情况下的标准过程:删除本地存储库中相应的插件文件夹:
这在大多数情况下都有帮助。
如果没有,您可能从存储库中获取了错误数据。如果您使用的是 Nexus,请重建索引。
Standard procedure in such cases: delete the corresponding plugin folder in your local repo:
This helps in most cases.
If not, you are probably getting bad data from a repository. If you are using a nexus, rebuild the index.