maven archetype:generate 第一次执行会出错。

问题描述 投票:0回答:3

我在运行eclipse kepler 4.3和maven 3.0.5的同时,还在运行 maven:archhetype生成 第一次,它说Failed to download required plugins.Build failed and throwing(下载失败)。NoPluginFoundForPrefixException异常...我是个新手,请谁能帮帮我。

    [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。

maven-3
3个回答
0
投票

似乎没有与远程maven仓库建立连接。IE代理可能会导致此故障。

请按照以下步骤解决这个问题:-。

第1步:检查你的代理详情-------------------------------------------。Tools-->Internet Options-->Connections-->LAN Settings

第二步:复制你的代理主机和端口

步骤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' 的位置。

第四步:保存文件。

第五步:在命令提示符下运行--。mvn:archetype generate

你的问题应该可以解决了。


0
投票

是的,我也有同样的问题,在marven文件夹的set.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>

© www.soinside.com 2019 - 2024. All rights reserved.