Failure to find net.sf.json-lib:json-lib:jar:2.2.2

博客主要讲述项目添加json-lib依赖时,打包执行mvn package报错的问题。提示找不到特定版本jar包,原因是jar名称中多了jdk13、jdk15,需添加classfier。修改配置后可找到对应jar包,还给出了相关参考链接。
Could not resolve dependencies for project com.platform:platform-gateway:jar:1.0: Failure to find net.sf.json-lib:json-lib:jar:2.2.2 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1]

在项目中添加json-lib依赖时:

<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
</dependency>

项目打包时时,执行 mvn package 查看到具体的详细信息:提示: Could not resolve dependencies for project com.platform:platform-gateway:jar:1.0: Failure to find net.sf.json-lib:json-lib:jar:2.2.2 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1]
的错误

根据提示打开: http://uk.maven.org/maven2/net/sf/json-lib/json-lib/2.4/

看到:

jar的名称中多了 jdk13、jdk15,所以需要添加classfier。classifier表示在相同版本下针对不同的环境或者jdk使用的jar, 如果配置了这个元素,则会将这个元素名在加在jar包的后面来查找相应的jar,所以上面的json-lib-2,4是找不到jar包的。修改为以下配置:

<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
    <classifier>JDK15</classifier>
</dependency>

这样配置即可找到json-lib-2.4-jdk15.jar 。

 

转载于:https://my.oschina.net/zhenggao/blog/3025080

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值