Original: http://www.cnblogs.com/winner-0715/p/5928514.html
Today, when adding Net.sf.json jar packages with Maven, the code is as follows:
<dependency> <groupId>net.sf.json-lib</groupId> <artifactid>json-lib</ Artifactid> <version>2.4</version></dependency>
reported a mistake.
Could not find artifact net.sf.json-lib:json-lib:jar:2.4 in central (HTTPS://REPO.MAVEN.APACHE.ORG/MAVEN2)
Missing Artifact Net.sf.json-lib:json-lib:jar:2.4:compile
Well? Strange, this is from the official web search configuration Ah, right? It is best to find a long time online, finally found the reason, Net.sf.json add the need to add the JDK version number, the first time I heard, so 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 did not, the compiler passed, but I use the local jdk7, and that configuration inside is Jdk5, this seems to have to write 5, I have tried to jdk16/jdk17 all, but only with JDK15 can be compiled through
---
Because the file is called Json-lib-2.4-jdk15.jar .....
Solution to Net.sf.json Error in maven (reprint)