版权声明: https://blog.csdn.net/asd54090/article/details/83510512
maven阿里云镜像地址:http://maven.aliyun.com/mvn/search
上面的地址不是在maven中配置的,只是方便我们去查询镜像仓库中都引入了maven的哪些库,因为我配置的maven镜像地址是阿里的,如果是其他的镜像地址也同理。
我需要net.sf.json-lib的包,在maven repository上的maven代码是:
<!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>
这样写,jar包下载不了
在lib管理中显示net.sf.json-lib has broken path
编译项目maven抛出:
Failure to find net.sf.json-lib:json-lib:jar:2.4 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 nexus-aliyun has elapsed or updates are forced -> [Help 1]
原因:
看图:
上图是maven repository中的所有json-lib版本及其附属信息
里面有JDK13和JDK15版本的,我们没有指定,maven不知道他要下哪一个,所以出错
解决:
在dependency中加一行:
<classifier>jdk15</classifier>
或
<classifier>jdk13</classifier>
完整json-lib的maven引入代码:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>