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依賴時:java
<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]
的錯誤json
根據提示打開: http://uk.maven.org/maven2/net/sf/json-lib/json-lib/2.4/maven
看到:spa
jar的名稱中多了 jdk1三、jdk15,因此須要添加classfier。classifier表示在相同版本下針對不一樣的環境或者jdk使用的jar, 若是配置了這個元素,則會將這個元素名在加在jar包的後面來查找相應的jar,因此上面的json-lib-2,4是找不到jar包的。修改成如下配置:code
<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 。orm