今天在使用Maven 构建项目的时候出现了以下的错误:apache
[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\project\.mave_repo\repo), central (http://repo1.maven.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException网络
怀疑是网络问题,可是打开maven
http://svn.apache.org/repos/asf/maven/plugins/tags/maven-clean-plugin-2.5/pom.xml 的时候居然能够打开,因而到网上搜索了一下,找到了以下答案:svn
解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另外一个是在maven的配置文件中设置联通网络下,可以访问的中央仓库的mirrors。由于也很差找稳定的代理,我就在网上搜索了两个可用的mirror站点,配置方式以下:测试
一、打开maven配置文件(maven安装目录下的conf目录下的settings.xml文件)this
二、搜索mirrors关键字,若是注释说明的下方没有 <mirrors>节点,则创建mirrors节点,带mirrors节点的全部配置以下(复制下面的内容,粘贴到配置文件中便可):url
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
</mirrors>.net
而后再测试一下,成功!debug
记录下来,但愿能够帮助到像遇到一样问题的人。为了表示对原做者的尊重,下附原文地址:代理