項目中要用到json-lib,mvnrepository.com查找它的dependency時結果以下:html
xml 代碼
<dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> </dependency>
可是在install的時候老是說找不到這個jar,因而上 http://json-lib.sourceforge.net/準備下載jar包本身install到repository上,這時候發現了mvnrepository上的一點小問題,json-lib提供了兩個jdk版本的實現, json-lib-2.1-jdk13.jar和json-lib-2.1-jdk15.jar,看來因而把dependency的描述修改爲下面的形式就就解決問題了:
xml 代碼
<!--json-lib-->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
--------------------------------------------------
com.alibaba.fastjson.JSONObject依賴代碼
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.28</version> </dependency>
net.sf.json.JSONObject依賴代碼java
<!-- JSONObject對象依賴的jar包 --> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.3</version> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>net.sf.ezmorph</groupId> <artifactId>ezmorph</artifactId> <version>1.0.6</version> </dependency> <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.2.3</version> <classifier>jdk15</classifier><!-- 指定jdk版本 --> </dependency>
XML轉換成JSON所依賴的jar包 xomjson
<!--將xml轉換成JSON 所依賴的jar包--> <dependency> <groupId>xom</groupId> <artifactId>xom</artifactId> <version>1.2.5</version> </dependency>