我正在尝试浏览Maven中的示例:The Definitive Guide。在第4.3章。创建简单天气项目'它让我运行以下命令。
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch04 -DartifactId=simple-weather -DpackageName=org.sonatype.mavenbook -Dversion=1.0
我认为这些错误是个问题。
[WARNING] POM for 'asm:asm-commons:pom:3.2:runtime' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project asm:asm-commons at Artifact [asm:asm-commons:pom:3.2:runtime]
[WARNING] POM for 'asm:asm-util:pom:3.2:runtime' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project asm:asm-util at Artifact [asm:asm-util:pom:3.2:runtime]
[WARNING] POM for 'asm:asm-analysis:pom:3.2:runtime' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project asm:asm-analysis at Artifact [asm:asm-analysis:pom:3.2:runtime]
[WARNING] POM for 'asm:asm-tree:pom:3.2:runtime' is invalid. It will be ignored for artifact resolution. Reason: Failed to validate POM for project asm:asm-tree at Artifact [asm:asm-tree:pom:3.2:runtime]
因为后来我收到了这条消息
[INFO] Failed to resolve artifact.
Missing
--------
org.apache.maven.archetype:archetype-catalog:jar:1.0
org.apache.maven.archetype:archetype-common:jar:1.0
org.apache.maven.archetype:archetype-registry:jar:1.0
org.apache.maven.archetype:archetype-descriptor:jar:1.0
我在调试时再次运行命令,并且我已将输出包含在pastebin链接中
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch04 -DartifactId=simple-weather -DpackageName=org.sonatype.mavenbook -Dversion=1.0 --debug > mvnoutput.txt
http://pastebin.me/e50a3e5fa84cd8e8ff9336b3c3062d7f
我真的不知道为什么会失败。我尝试使用
手动导航到POMhttp://search.maven.org/remotecontent?filepath=asm/asm-commons/3.2/asm-commons-3.2.pom和其他POM一起看起来很好(但我正在努力学习Maven。)
这是我的mvn有效设置。我在一开始就遗漏了模式。我支持代理,但其他一切似乎都下载得很好。任何帮助将非常感激。如果你把它们留作评论,我会回答问题或发布更多信息。
<localRepository>C:\Documents and Settings\~removed~\.m2\repository</localRepository>
<proxies>
<proxy>
<active>true</active>
<username>~removed~</username>
<password>~removed~</password>
<host>~removed~</host>
<nonProxyHosts>~removed~</nonProxyHosts>
<id>optional</id>
</proxy>
答案 0 :(得分:1)
最重要的是从Maven 3.0.4开始,而不是Maven 2.0.8。此外,您需要使用:
mvn archetype:generate
而不是
mvn archetype:create
的文档
我承认的一件事是您使用的是旧书:请查看"Maven by Example" book和"Maven: The Complete Reference"。