我生成了默认的快速开始Maven示例,并输入mvn checkstyle:checkstyle
,它总是尝试使用最新的SNAPSHOT
版本。可能这在我的Nexus服务器上是错误的,但我如何在Maven 2的命令行上设置插件的版本,例如将checkstyle的版本设置为2.5
而不是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
中设置构建依赖,肯定可以生效,但我想看看命令行怎么用。