如何解决Maven出现Couldnotfindartifact的问题,
分享于 点击 18696 次 点评:133
如何解决Maven出现Couldnotfindartifact的问题,
目录
- 问题描述
- 解决办法
- 假如settings.xml 指定阿里云源
- settings.xml文件配置内容
- 总结
问题描述
在IDEA创建Spring Initializr项目,选择下载依赖时
项目构建时爆出:
Could not find artifact com.mysql:mysql-connector-j:pom:unknown in central (https://repo.maven.apache.org/maven2)
解决办法
假如settings.xml 指定阿里云源
mirror仅仅配置central的代理镜像
其它仓库通过settings文件的profile或pom文件来配置
可以通过IDEA中maven的配置找到该文件位置
(构建工具 ——Maven——用户设置文件)
settings.xml文件配置内容
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"> <pluginGroups> </pluginGroups> <proxies> </proxies> <servers> </servers> <mirrors> <mirror> <id>aliyun-maven-mirror</id> <mirrorOf>centeral</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors> <profiles> </profiles> </settings>
然后重新构建,就不会报Could not find artifact
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持3672js教程。
您可能感兴趣的文章:- 解决 IDEA Maven 项目中"Could not find artifact" 问题的常见情况和解决方案
- maven导入本地仓库jar包,报:Could not find artifact的解决
- Maven中Could not find artifact XXXX的错误解决
用户点评