Maven 报错

今天在使用Maven 构建项目的时候出现了如下的错误:

[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

怀疑是网络问题,但是打开

http://svn.apache.org/repos/asf/maven/plugins/tags/maven-clean-plugin-2.5/pom.xml 的时候竟然可以打开,于是到网上搜索了一下,找到了如下答案:

解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另一个是在maven的配置文件中设置联通网络下,能够访问的中央仓库的mirrors。因为也不好找稳定的代理,我就在网上搜索了两个可用的mirror站点,配置方式如下:

1、打开maven配置文件(maven安装目录下的conf目录下的settings.xml文件)

2、搜索mirrors关键字,如果注释说明的下方没有  <mirrors>节点,则建立mirrors节点,带mirrors节点的所有配置如下(复制下面的内容,粘贴到配置文件中即可):

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

然后再测试一下,成功!

记录下来,希望可以帮助到像遇到同样问题的人。为了表示对原作者的尊重,下附原文地址:

http://blog.csdn.net/shycx/article/details/7726600

转载于:https://my.oschina.net/u/1419455/blog/344005

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值