坚持认真做一件事 时间看得见

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2602|回复: 0

配置maven无法下载(COULD NOT TRANSFER ARTIFACT ORG.APACHE.MAVEN.PLUGIN...

[复制链接]

41

主题

64

帖子

268

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
268
发表于 2022-5-16 14:34:29 | 显示全部楼层 |阅读模式
问题描述:

在学习maven项目时,下载jar包一直出错,看了很多博客都不行,最后才知道是最开始看的那篇博客的镜像有问题,原地爆炸。

  1. Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.7.0 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.7.0/mave
复制代码

解决方案:1,查看settings配置中的镜像是否有问题

我们需要在settings中配置镜像,不然得享受蜗速,同时若是使用的过期镜像也会导致,我们不能下载maven包。具体操作如下:
配置阿里云镜像资源

  1. <mirror>
  2.     <id>central</id>
  3.     <mirrorOf>public</mirrorOf>
  4.     <name>aliyun maven</name>
  5.     <url>https://maven.aliyun.com/repository/central</url>
  6.     </mirror>
  7.     <mirror>
  8.     <id>alimaven</id>
  9.     <mirrorOf>public</mirrorOf>
  10.     <name>aliyun maven</name>
  11.     <url>https://maven.aliyun.com/repository/public</url>
  12.     </mirror>
  13.     <mirror>
  14.    <id>alimaven</id>
  15.    <mirrorOf>jcenter</mirrorOf>
  16.    <name>aliyun maven</name>
  17.    <url>https://maven.aliyun.com/repository/public</url>
复制代码
2,查看settings配置是否有问题

IDEA->setting里去找Maven,如下Maven home路径和之下的User settings file路径是否一致。不一致的话我们需要将我们解压的maven文件下的settings文件路径拷贝到对应的输入框。


3,更改idea中的证书问题

证书错误,访问https协议的网站,需要ssl认证才行,这里没有证书,我们可以用下面的方式忽略ssl检查导致的问题。
我们可以到IEDA->setting里,去找 Maven,在importing里加入如下的语句:

  1. -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
复制代码

到这里基本就ok了如果证书问题还是解决不了,我们再向File - settings中的maven - Runner中添加这句话:
  1. -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -DarchetypeCatalog=internal
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|坚持认真做一件事 时间看得见 ( 闽ICP备17010916号 )

GMT+8, 2026-5-4 20:15 , Processed in 0.057454 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表