特此声明:
json-lib-2.4-jdk15.jar仅它本身不够,必须如下的几个依赖架包都有才能使用!!!
首先 将.json-lib-2.4-jdk15.jar以及其相关的依赖架包的正确配置给出【pom.xml文件】:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
12 7 8net.sf.json-lib 3json-lib 42.4 5jdk15 69 13commons-lang 10commons-lang 112.5 1214 18commons-beanutils 15commons-beanutils 161.9.2 1719 23commons-collections 20commons-collections 213.2.1 2224 commons-logging 25commons-logging 261.2 27
其次,说说遇到的问题:
问题1:json-lib:json-lib:jar:2.4一直报错的问题
初始的时候,是这样的:
所报的错误是:Missing artifact net.sf.json-lib:json-lib:jar:2.4
但是此时我的这个架包已经下载我的本地仓库了。这maven是不是搞笑??
解决方法:
但是对比本地仓库中的架包和pom.xml中配置的,总感觉架包有些许不正常,
本地仓库中的架包长这个样子:
查找后发现我们需要在这个JSON架包中添加节点<classifier>jdk15</classifier>:
这个就是网上查到的解决方法:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
12 net.sf.json-lib 3json-lib 42.4 5jdk15 6
问题2: json-lib的依赖架包中commons-lang架包一直报错
所报错误如下:
ArtifactTransferException: Failure to transfer commons-lang:commons-lang:jar:2.6 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact commons-lang:commons-lang:jar:2.6 from/to central (http://repo.maven.apache.org/maven2): Connection timed out: connect
说是不能加载这个架包!!
解决问题:
在本地仓库查看之后,发现这个架包在本地也有。这就奇怪了!!
而且不像问题1中的问题一样。这很尴尬!!这一看,明显不是缺少节点!!
然后报出上述问题,可能是:
1.网路不好,下载到本地的架包是损坏的,将其删除,重新下载
2.更换版本较低的架包
于是: 将版本更换为2.5的就好了
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
12 commons-lang 3commons-lang 42.5 5
问题解决!!!!