今天在使用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
記錄下來,但願能夠幫助到像遇到一樣問題的人。爲了表示對原做者的尊重,下附原文地址:代理