maven中net.sf.json報錯的解決方案

來源:互聯網
上載者:User

標籤:

今天在用maven添加net.sf.json的jar包的時候,代碼如下:

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

報了一個錯

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

嗯 ?奇怪了,這個是從官網上查的配置啊,不對嗎?最好在網上找了好久,終於找到原因了,net.sf.json添加的時候需要添加jdk的版本號碼,第一次聽說,於是有了下面的配置

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

結果,錯誤沒有了,編譯通過了,但是我本地用的是jdk7,而那個配置裡面卻是jdk5,這個好像必須寫5,我把jdk16/jdk17都試了一遍都不行,無奈只有用jdk15可以編譯通過

---

因為檔案名稱叫json-lib-2.4-jdk15.jar.....

 

maven中net.sf.json報錯的解決方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.