The solution to the error of net.sf.json in maven: The solution to the error of net.sf.json in the original maven

When adding the jar package of net.sf.json with maven today, the code is as follows:

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

reported an error

Missing artifact net.sf.json-lib:json-lib:jar:2.4:compile

Um? Strange, this is the configuration checked from the official website, right? It is best to search for a long time on the Internet, and finally found the reason. When adding net.sf.json, you need to add the version number of jdk. This is the first time I heard about it, so I have the following configuration

<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
    <classifier>jdk15</classifier>
</dependency>

As a result, the error is gone, the compilation is passed, but I use jdk7 locally, and the configuration is jdk5, this seems to have to write 5, I tried jdk16/jdk17 again, but I can only use jdk15 to compile. Pass, friends who know the reason, please leave a message.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325950031&siteId=291194637