Let’s start with a dependency

<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
</dependency>
Copy the code

Seems okay? Do you think you can get down? The answer is no, not down.

Take a look at Maven’s file index directory:

The Index of/maven2 / net/sf/json – lib/json – 2.4 / lib /

. Json-lib-2.4-jdk13.jar 2010-12-14 05:39 158091 json-lib-2.4-jdk13.jar. Md5 2012-11-27 09:40 32 Json-lib-2.4-jdk13.jar 2010-12-14 05:39 245414 json-lib-2.4-jdk13.jar 2010-12-14 05:39 245414 Json-lib-2.4-jdk13-javadoc.jar. Md5 2012-11-27 09:40 32 json-lib-2.4-jdk13-javadoc.jar. Sha1 2012-11-27 09:210 40 Json-lib-2.4-jdk13-sources.jar 2010-12-14 05:39 102628 json-lib-2.4-jdk13-sources.jar Json-lib-2.4-jdk13-sources.jar. Sha1 2012-11-27 09:21 40 json-lib-2.4-jdk15.jar 2010-12-14 05:39 159123 Json-lib-2.4-jdk15.jar. Md5 2012-11-27 09:40 32 json-lib-2.4-jdk15.jar. Sha1 2012-11-27 09:210 40 Json-lib-2.4-jdk15-javadoc.jar 2010-12-14 05:39 248552 json-lib-2.4-jdk15-javadoc.jar. Md5 2012-11-27 09:40 32 Json-lib-2.4-jdk15-sources. jar 2010-12-14 05:39 104992 Json-lib-2.4-jdk15-sources.jar. Md5 2012-11-27 09:40 32 json-lib-2.4-jdk15-sources.jar Json-lib-2.4. pom 2010-12-14 05:39 13082 json-lib-2.4.pom.md5 2012-11-27 09:40 32 Json-lib-2.4.pom. sha1 2012-11-27 09:21 40Copy the code

According to Maven’s default organization package structure, there is no jSON-lib-2.4. jar package here, so it cannot be downloaded.

There is no standard jar package, but there are extended, such as: json – lib – 2.4 – jdk15. Jar, so, here to introduce classifier this element, element of classifier is used to help define the components of the output some ancillary components.

So, add classifier here to download the extension package json-lib-2.4-jdk15.jar.

< the dependency > < groupId >.net. Sf. Json - lib < / groupId > < artifactId > json - lib < / artifactId > < version > 2.4 < / version > <classifier>jdk15</classifier> </dependency>Copy the code

Then you can download the corresponding dependencies.

Here take jSON-lib as an example, but it has stopped updating and maintenance, so it is not recommended to use fastjson, Jackson, Gson and other JSON conversion frameworks.

Recommended reading

Dry goods: 2TB architect four-stage video tutorial

Interview: the most complete Java multithreaded interview questions and answers

Interview: the most comprehensive ali advanced Java interview questions in history

Interview: The most complete Spring interview questions in history

Tutorial: The most complete Spring Boot complete video tutorial

Books: 15 must-read books for advanced Java architects

Tools: Recommended an online creation flow chart, mind mapping software

Share Java dry goods, high concurrency programming, hot technology tutorials, microservices and distributed technology, architecture design, blockchain technology, artificial intelligence, big data, Java interview questions, and cutting-edge hot news.