maven系列--Could not resolve dependencies问题的解决
来源:互联网 发布:excel如何合并数据 编辑:程序博客网 时间:2024/05/16 09:04
一、问题描述
1.1 问题背景
在调用这两个第三方包时,
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
需要在maven的pom.xml文件中添加依赖。由于其他原因前后共添加了两个关于Json的依赖,如下:
1.<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>1.5-20090211</version>
</dependency>
2.<!--json-lib -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
所以在执行
mvn clean package
命令时报错。
1.2 详细描述
报错信息截图如下:
二、原因分析
Could not resolve dependencies for project for cn.edu.sdut.softlab.YZYWeiXin:YZYWeiXin:war 。。。
重点:Failure to find org.json:json:jar:… …in https://… … was cached in the local repository ,resolution will not reattempt util the update interval of central has elapsed or updates are forced.
个人理解就是maven的本地仓库已经有了两个版本或者说是两种json依赖,maven无法决定使用哪一个,导致报错了。
三、问题解决
3.1 查看本地.m2仓库下json的情况
如下图所示,共有两个版本的json依赖。
3.2 删掉其中一个json
问题就很容易解决了,删掉其中一个或者全部删掉再重新下载都可以。
四、问题延展
记得去年遇到另一种依赖下载出错的情况,大体是已经下载到即Cached到本地仓库的某个依赖是错误的,导致出错,具体详情参见本人两一篇博客:
http://blog.csdn.net/qq_33429968/article/details/53438712
- maven系列--Could not resolve dependencies问题的解决
- Maven : Could not resolve dependencies...
- 管理工具---Maven系列(一)编译问题Could not resolve dependencies for project
- maven的Could not resolve dependencies 的异常以及处理
- Maven:Could not resolve dependencies for project
- Maven Could not resolve dependencies, artifacts could not be resolved
- 解决ionic编译android支持问题> Could not resolve all dependencies for configuration ':_debugCompile'. > Co
- Maven instal Could not resolve dependencies for project 找不到本地仓库下的jar
- maven依赖的项目报错Could not resolve dependencies for project
- Maven instal Could not resolve dependencies for project 找不到本地仓库下的jar
- Maven instal Could not resolve dependencies for project 找不到本地仓库下的jar
- 【已解决】could not resolve all dependencies for configuration ':claapath'
- 解决使用eclipse创建maven web项目时报Could not resolve archetype的问题
- Could not resolve all dependencies for configuration
- 关于Could not resolve dependencies for project
- Could not resolve dependencies for project . Could not find artifact
- IDEA maven 项目打包报Could not resolve dependencies for project
- 聚合工程maven报错:Could not resolve dependencies for project
- EAS8.0,EAS8.2,WAF2,SpringMVC注解方式编写控制层
- 关于Excel导入功能的细节问题
- LEFT JOIN ... ON ... 四表联查实例
- Unity协程(Coroutine)原理深入剖析
- Python中多个数组行合并及列合并的几个简单方法
- maven系列--Could not resolve dependencies问题的解决
- 欢迎使用CSDN-markdown编辑器
- 在线学习各种环境和系统的搭建
- 兼容Android7.0传递图片的URI
- java项目导入
- Java关键字final、static使用总结
- Educational Codeforces Round 22
- This absolute uri http://Java.sun.com/jsp/jstl/core) cannot be resolved in either web.xml or the jar
- What are: DNS, DHCP, IP Addresses and Subnet Mask