maven archetype:生成第一次执行抛出错误

时间:2013-11-20 04:42:50

标签: maven-3

我正在运行eclipse kepler 4.3和maven 3.0.5,而第一次运行 maven:archetype generate 时说它无法下载所需的插件。修复失败并抛出 NoPluginFoundForPrefixException 。我是maven的新手,请有人帮助我。

    [INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-clean-plugin:2.4.1: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 o
r one of its dependencies could not be resolved: Failed to read artifact descrip
tor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-install-plugin:2.3.1: Plugin org.apache.maven.plugins:maven-install-plugin:2.3
.1 or one of its dependencies could not be resolved: Failed to read artifact des
criptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or
one of its dependencies could not be resolved: Failed to read artifact descripto
r for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
site-plugin/3.0/maven-site-plugin-3.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-site-plugin:3.0: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one
of its dependencies could not be resolved: Failed to read artifact descriptor fo
r org.apache.maven.plugins:maven-site-plugin:jar:3.0
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or
one of its dependencies could not be resolved: Failed to read artifact descripto
r for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plu
gin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-b
eta-5
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin
:2.1 or one of its dependencies could not be resolved: Failed to read artifact d
escriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
release-plugin/2.0/maven-release-plugin-2.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:mave
n-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 o
r one of its dependencies could not be resolved: Failed to read artifact descrip
tor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadat
a.xml
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xm
l from/to central (http://repo.maven.apache.org/maven2): Connection to http://re
po.maven.apache.org refused
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/
to central (http://repo.maven.apache.org/maven2): Connection to http://repo.mave
n.apache.org refused
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from h
ttp://repo.maven.apache.org/maven2 was cached in the local repository, resolutio
n will not be reattempted until the update interval of central has elapsed or up
dates are forced. Original error: Could not transfer metadata org.apache.maven.p
lugins/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2):
 Connection to http://repo.maven.apache.org refused
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from http://r
epo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates a
re forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-m
etadata.xml from/to central (http://repo.maven.apache.org/maven2): Connection to
 http://repo.maven.apache.org refused.

这是我从命令行获得的...我正在使用Windows 7.

2 个答案:

答案 0 :(得分:0)

似乎连接尚未建立到远程maven存储库。 IE代理可能导致此失败。

按照以下步骤解决此问题: -

第1步:在Tools-->Internet Options-->Connections-->LAN Settings

上查看您的代理商详细信息

第2步:复制代理主机和端口

第3步:转到默认的本地存储库位置:Default: ~/.m2/repository并编辑'settings.xml'文件

搜索代理标记并填写如下所示的详细信息 -

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username><user-name></username>
  <password><password></password>     
  <host><proxy-host></host>
  <port>80</port>          
</proxy>

默认代理端口:80(根据您的设置应用)

如果您未在'settings.xml'默认存储库位置找到'~/.m2/repository'文件,请从'~\apache-maven-3.0.5\conf'位置复制此文件。

第4步:保存文件。

第5步:在命令提示符上运行 - mvn:archetype generate

你的问题应该得到解决。

答案 1 :(得分:0)

是的我有同样的问题,通过命令

在marven文件夹的setting.xml文件中配置代理
sudo gksu gedit /usr/share/maven/conf/settngs.xml

然后取消注释代理部分并设置您的代理,如下所示

<proxies>
<!-- proxy
 | Specification for one proxy, to be used in connecting to the network.
 |
-->
<proxy>
    <id>optional</id>
    <active>true</active>
    <protocol>http</protocol>
    <username></username>
    <password></password>
    <host>10.3.100.207</host>
    <port>8080</port>
    <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>