Java Maven 项目问题:com.diogonunes:JColor:jar:5.5.1 was not found in...

问题与处理策略

问题描述
  • IDEA 中打开一个 Java 项目,使用 Maven 构建时,报如下错误
com.diogonunes:JColor:jar:5.5.1 was not found in https://repo1.maven.org/maven2/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of repo1 has elapsed or updates are forced

Try to run Maven import with -U flag (force update snapshots)
# 翻译

com.diogonunes:JColor:jar:5.5.1 在之前的尝试中未能从 https://repo1.maven.org/maven2/ 找到

此故障已缓存在本地存储库中,在 repo1 的更新间隔结束或强制更新之前,不会重新尝试解决

尝试使用 -U 参数运行 Maven 导入(强制更新快照依赖)
问题原因
  1. Maven 无法从目标仓库中找到此依赖

  2. Maven 将下载失败的记录缓存到了本地仓库中,导致后续构建时不会重试下载

处理策略
(1)强制更新依赖
  1. 点击 Try to run Maven import with -U flag (force update snapshots),强制更新依赖

  2. 这样会强制 Maven 检查远程仓库的更新,即使本地仓库中已经缓存了失败的记录

(2)使用镜像仓库
  • 由于 Maven 无法从目标仓库中找到此依赖,可以在 settings.xml 文件中添加镜像仓库
<mirrors>
  <mirror>
    <id>aliyunmaven</id>
    <mirrorOf>central</mirrorOf>
    <url>https://maven.aliyun.com/repository/public</url>
  </mirror>
</mirrors>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值