maven命令创建应用报错问题解决

C:\Users\tx>mvn archetype:generate -DgroupId=com.alibaba.webx -DartifactId=tutorial3 -Dversion=1.0-SNAPSHOT -Dp
ackage=com.alibaba.webx.tutorial3 -DarchetypeArtifactId=archetype-simple-webx3 -DarchetypeGroupId=com.alibaba.citrus.sam
ple -DinteractiveMode=false
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.apache.maven.plugins:maven-archetype-plugin

Reason: Error getting POM for 'org.apache.maven.plugins:maven-archetype-plugin' from the repository: Failed to resolve a
rtifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
  org.apache.maven.plugins:maven-archetype-plugin:pom:2.3-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project org.apache.maven.plugins:maven-archetype-plugin


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri Nov 09 11:28:07 CST 2012
[INFO] Final Memory: 2M/1016M
[INFO] ------------------------------------------------------------------------

mvn archtype:generate 自行会到本地仓库查找archtype插件,查看本地D:\work\repository\org\apache\maven\plugins\maven-archetype-plugin下的插件版本为2.2,而maven-metadata-central.xml是2.3-SNAPSHOT并且仓库中没有这个版本的jar包,所以出错。

xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>org.apache.maven.pluginsgroupId>
  <artifactId>maven-archetype-pluginartifactId>
  <versioning>
    <latest>2.3-SNAPSHOTlatest>
    <release>2.2release>
    <versions>
      <version>1.0-alpha-3version>
      <version>1.0-alpha-4version>
      <version>1.0-alpha-7version>
      <version>2.0-alpha-1version>
      <version>2.0-alpha-2version>
      <version>2.0-alpha-3version>
      <version>2.0-alpha-4version>
      <version>2.0-alpha-4-alipayversion>
      <version>2.0-alpha-4.alipayversion>
      <version>2.0-alpha-4-alipay-bugfix1version>
      <version>2.0-alpha-4-alipay-bugfix2version>
      <version>2.0-alpha-5version>
      <version>2.0-alpha-6-SNAPSHOTversion>
      <version>2.0version>
      <version>2.1version>
      <version>2.2version>
      <version>2.3-SNAPSHOTversion>
    versions>
    <lastUpdated>20120228230945lastUpdated>
  versioning>
metadata>

解决方法:

   把maven-metadata-central.xml文件中的2.3-SNAPSHOT去掉,选择2.2版本。

   

转载于:https://www.cnblogs.com/iusmile/archive/2012/11/09/2762307.html

你可能感兴趣的:(maven命令创建应用报错问题解决)