现在的位置: 首页 > 综合 > 正文

使用maven创建新项目出现Unable to determine the release version错误

2013年03月25日 ⁄ 综合 ⁄ 共 2630字 ⁄ 字号 评论关闭

当使用mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app来创建一个新项目时,有时候会出现以下错误:

[INFO] Scanning for projects...
 [INFO] Searching repository for plugin with prefix: 'archetype'.
 [INFO]
 ----------------------------------------------------------------------------
 [INFO] Building Maven Default Project
 [INFO]    task-segment: [archetype:create] (aggregator-style)
 [INFO]
 ----------------------------------------------------------------------------
 。。。。。。。
 [INFO] Velocimacro : initialization complete.
 [INFO] Velocity successfully started.
 [INFO] [archetype:create]
 [INFO] Defaulting package to group ID: com.mycompany.app
 [INFO]
 ------------------------------------------------------------------------
 [ERROR] BUILD ERROR
 [INFO]
 ------------------------------------------------------------------------
 [INFO] Failed to resolve artifact.

GroupId: org.apache.maven.archetypes
 ArtifactId: maven-archetype-quickstart
 Version: RELEASE

Reason: Unable to determine the release version

Try downloading the file manually from the project website.

Then, install it using the command:
     mvn install:install-file -DgroupId=org.apache.maven.archetypes
 -DartifactId=maven-arch
 etype-quickstart /
         -Dversion=RELEASE -Dpackaging=jar -Dfile=/path/to/file

  org.apache.maven.archetypes:maven-archetype-quickstart:jar:RELEASE

 [INFO]
 ------------------------------------------------------------------------
 [INFO] For more information, run Maven with the -e switch
 [INFO]
 ------------------------------------------------------------------------
 [INFO] Total time: 1 second
 [INFO] Finished at: Tue Apr 17 07:08:50 MDT 2007
 [INFO] Final Memory: 4M/8M
 [INFO]
 ------------------------------------------------------------------------
         请注意红色部分为错误产生的根本原因,  由于maven还处于开发过程中,开发方极有可能已经更新某个plug-in的版本,但本地plug-in 的metadata没有版本的信息或者没有最新版本的信息,致使maven无法下载正确的版本。同时请注意蓝色部分,这是提示的解决办法。具体步骤如下:
    1.打开网址:http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/archetypes/maven-archetype-quickstart/
     2.选择最新版本并且下载最新的“maven-archetype-quickstart-1.0-alpha-4.jar ”文件
     3.安装这个archetype到maven本地仓库。使用命令如下:mvn install:install-file -DgroupId=org.apache.maven.archtypes -Dar
 tifactId=maven-archetype-quickstart -Dversion=1.0-alpha-4 -Dpackaging=jar -Dfile=c:/7000/maven/maven-archetype-quickstart-1.0-alpha-4.jar。注意-Dfile是刚下载的文件的路径。
     现在在cmd中执行mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app就可以创建新项目了。
Feedback
# re: 使用maven创建新项目出现Unable to determine the release version错误  回复  更多评论   
 2008-04-09 09:41 by lizhh
请教一个问题:我安装了maven2.0.8版本,只有安装文件下的conf/settings.xml ,在网上看还有个用户级的settings.xml在用户目录下的.m2/settings.xml.我的.m2下怎么没有settings.xml?
# re: 使用maven创建新项目出现Unable to determine the release version错误  回复  更多评论   
 2008-04-10 17:06 by zjibo
.m2/settings.xml是选择默认安装目录才会有的。

抱歉!评论已关闭.