IntelliJ Maven error: Repository is non-nexus repo, or is not indexed (remote update error)

问题

使用idea在增加的时候提示慢,或者没有提示,导致我们编辑pom文件的时候很烦.
idea可以通过依赖索引提供依赖提示的功能:
在这里插入图片描述

idea 配置快速索引

Ctrl+Alt +S 打开settiings

图一
按照上图操作 点击 update 即可.

导致update Remote error 的原因

我们知道apache-maven的settings.xml不做任何配置时是有默认的仓库的,这个仓库就是central仓库,默认值是https://repo.maven.apache.org/maven2/,我们可以配置mirrorOf=central只镜像默认的central仓库。
一般情况下我们会配置阿里云镜像仓库加速依赖下载,在Maven的settings.xml文件下设置来指定镜像仓库
在这里插入图片描述

但是阿里云镜像仓库不支持依赖索引,导致我们索引更新失败. error警报.
IntelliJ Maven error: Repository is non-nexus repo, or is not indexed (remote update error)

解决办法

1.直接使用是Maven的中央仓库,进行索引加载(过程很慢文件太多了)
<mirror>  
 <id>central</id>  
 <mirrorOf>*</mirrorOf>  
 <name>manve2</name>  
 <url>https://repo.maven.apache.org/maven2</url>  
</mirror> 	

在这里插入图片描述

2. 没有网络的情况下可以把中央仓库的索引下载到本地,进行本地加载

一共分为两个步骤

  • 第一步: 下载索引
  • 第二部:这只本地镜像加载索引
    下面介绍下流程
  1. 下载索引
    转到 https://repo.maven.apache.org/maven2/.index/ 下载6个文件 到本地:
    nexus-maven-repository-index.gz
    nexus-maven-repository-index.gz.md5
    nexus-maven-repository-index.gz.sha1
    nexus-maven-repository-index.properties
    nexus-maven-repository-index.properties.md5
    nexus-maven-repository-index.properties.sha1
    这里我下载到了f盘 maven2/.index 文件夹下
    在这里插入图片描述
    注意: 文件夹一定要和上图保持一致.
  2. 配置settings.xml 文件
 <mirror>  
 <id>default</id>  
 <mirrorOf>central</mirrorOf>  
 <name>local</name>  
 <url>file://F:maven2/</url>  
</mirror>   
  1. 重启idea 然后update索引
    在这里插入图片描述
    更新完毕
    在这里插入图片描述

4.更新完记得恢复settings文件
在这里插入图片描述
好了,现在就可以快速索引了
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值