【发布时间】:2010-05-20 04:42:32
【问题描述】:
我生成默认的快速入门 Maven 示例,并输入 mvn checkstyle:checkstyle,它总是尝试使用最新的 SNAPSHOT 版本。可能在我的 Nexus 服务器中是错误的,但是如何在 Maven 2 的命令行中设置插件的版本,例如 2.5 用于 checkstyle 而不是 2.6-SNAPSHOT?
C:\HelloWorld>mvn checkstyle:checkstyle
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'checkstyle'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-checkstyle-plugin
Reason: Error getting POM for 'org.apache.maven.plugins:maven-checkstyle-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
org.apache.maven.plugins:maven-checkstyle-plugin:pom:2.6-SNAPSHOT
from the specified remote repositories:
nexus (http://localhost:9081/nexus/content/groups/public)
for project org.apache.maven.plugins:maven-checkstyle-plugin
我猜可能是mvn checkstyle:2.5:checkstyle,可惜不是。
当然,如果我在pom.xml 中设置构建依赖关系,它会起作用,但我想看看命令行如何工作。
【问题讨论】:
-
如果我输入完整的工件,它可以工作 mvn org.apache.maven.plugins:maven-checkstyle-plugin:2.5:checkstyle