json-lib 的maven dependency ( 摘 )
项目中要用到json-lib,mvnrepository.com查找它的dependency时结果如下:
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依赖代码
<!-- 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包 xom
<!--将xml转换成JSON 所依赖的jar包--> <dependency> <groupId>xom</groupId> <artifactId>xom</artifactId> <version>1.2.5</version> </dependency>
新手操作,仅用作学习笔记,如有不正确之处,望指正!