idea 创建Maven项目,Enable auto Import报“本地服务器没有从权威服务器上收到响应”

完整的报错信息:Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://rpo.apache.org),它意味着“本地服务器没有从权威服务器上收到响应”

操作步骤:

1.初次使用idea创建Maven项目

2.项目创建成功后,右下角提示“Maven project need to be imported” ,点击“Enable Auto-Import”

 点击之后就报错啦~~~~~~~~~~~~

 

报错的原因:

idea的maven一开始是没有setting.xml的,要去maven的目录里面拷一份setting.xml到你的仓库中。idea的maven在安装路径的plugins文件夹下,即X:\xxx\JetBrains\IntelliJ IDEA 2016.3.2\plugins\plugins\maven\lib\maven3\conf\setting.xml(即idea的安装路径)拷贝到你的用户文件夹下的.m2文件夹下,为了之后能够快速的下载依赖包

解决方法: 

1、找到用户文件夹:.m2,将这个文件复制进去

2、编辑settings.xml文件,加上官方库镜像,下载比国外的快。

<mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

  

3、setting.xml文件配置完成后,进到idea,此时已经在自动下载Maven库需要的文件,下图代表成功啦,不会报错啦!

原文参考:https://blog.csdn.net/Doctor_LY/article/details/84998052

猜你喜欢

转载自www.cnblogs.com/cuitang/p/12608588.html
今日推荐