解决No plugin found for prefix 'archetype' in the current project and in the plugin groups

建立maven项目的时候可能会遇见Non-parseable settings expected START_TAG or END_TAG,也可能会遇见Caused by: org.apache.maven.plugin.MojoFailureException: Unable to add module to the current project,前一个问题是标签空格不当导致的,解决方法可以参考这篇博客,后一个是当前项目已经是个maven项目了,在创建是不行的,换一个不是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 (C:\Users\NayelyA\.m2\repository), central (https://repo.mav
en.apache.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

上网搜了一下博客,大多都说是由于网络问题导致的,我访问了下settings.xml里面的镜像,无一例外,打不开…
解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另一个是在maven的配置文件中能够访问的中央仓库的mirrors。在这里采取的方法是第二种,在网上搜索了几个可用的mirror站点,配置方式如下:

1、打开maven配置文件settings.xml(maven安装目录下的conf目录下的settings.xml文件)
2、搜索mirrors关键字,如果注释说明的下方没有< mirrors >节点,则建立mirrors节点,带mirrors节点的所有配置如下,可自行根据实际情况粘贴:

  <mirrors>
     <mirror>
           <id>alimaven</id>
           <name>aliyun maven</name>
           <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
           <mirrorOf>central</mirrorOf>        
     </mirror>
     <mirror>
           <id>UK</id>
           <name>UK Central</name>
           <url>http://uk.maven.org/maven2</url>
           <mirrorOf>central</mirrorOf>
     </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>

如果粘贴复制仍然不行后,建议大家搜搜比较稳定的mirror镜像,然后粘贴进来,再次进行测试,此外,一定要保证执行创建maven项目的语句是正确的!!

  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值