解决命令行构建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:UsersNayelyA.m2
epository), 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

该问题由于网络问题导致,已有的镜像仓库

https://maven.aliyun.com/repository/central

无法访问或者网速过慢

将setting.xml改成如下,即可

<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项目只使用了第一个mirror)

http://maven.aliyun.com/nexus/content/groups/public/
经验分享 程序员 微信小程序 职场和发展