解决命令行构建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

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

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/


参考链接:https://blog.csdn.net/weixin_40992982/article/details/104087472

根据提供的引用内容,你遇到了在使用IDEA和Maven时出现私服报错的问题。这可能是由于配置问题或者网络连接问题导致的。下面是一些可能的解决方法: 1. 检查Maven配置:确保你的Maven配置文件(settings.xml)中正确配置了私服的URL和凭据。你可以在该文件中添加以下内容: ```xml <servers> <server> <id>your_server_id</id> <username>your_username</username> <password>your_password</password> </server> </servers> ``` 请将`your_server_id`替换为私服的ID,`your_username`和`your_password`替换为你的私服凭据。 2. 检查网络连接:确保你的网络连接正常,并且可以访问私服的URL。你可以尝试使用浏览器或者命令行工具(如curl或wget)访问私服的URL,以确认是否可以正常连接。 3. 清理Maven缓存:有时候Maven缓存中的某些文件可能会导致问题。你可以尝试清理Maven的本地仓库缓存,然后重新构建项目。你可以使用以下命令清理Maven缓存: ```shell mvn dependency:purge-local-repository ``` 4. 更新Maven依赖:如果你的项目依赖的某些库已经更新了版本,但是私服中还没有同步更新,可能会导致报错。你可以尝试更新你的项目依赖,或者在Maven配置文件中添加其他可用的仓库。 希望以上方法能够帮助你解决问题。如果问题仍然存在,请提供更多的错误信息和具体的配置细节,以便我们能够更好地帮助你。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值