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 。