2016-04-14 38 views
2

我是新來的Clojure,並已卡住的一段時間:要求。我使用的雷音,並列入我project.clj:需要用Clojure data.json似乎並不奏效

:dependencies [[org.clojure/clojure "1.6.0"] 
      [http-kit "2.1.18"] 
      [org.clojure/data.json "0.2.6"]]) 

我檢查類路徑,並試圖:要求data.json,因爲它的data.json Github的頁面上說,但它說不能在路徑中找到。我試過

:require [org.httpkit.client :as http] 
     [clojure.string :as str] 
     [clojure.data.json :as json])) 

隨着org.clojure.data.json和一大堆其他東西。在我的類路徑中,它說

.m2/repository/org/clojure/data.json/0.2.6/data.json-0.2.6.jar 

所以我知道它在我的classpath中。

感謝

編輯

在我core.clj我的全NS腳本是

(ns myproject.core 
    (import [java.net URLEncoder]) 
    (:require [org.httpkit.client :as http] 
      [clojure.string :as str] 
      [clojure.data.json :as json])) 

只是爲了澄清我使用/檢出導入一個項目到另一個/。當我刪除data.json行它的工作,但不適用於它。

+0

你在哪裏把你的'require'片段? project.clj或你的命名空間文件? –

+0

@Piotrek我把它放在core.clj文件中。我試過其他項目,似乎無法讓他們工作。 – phlie

+1

你列在你的DEPS'org.clojure/data.json',但在你的文件需要'cheshire.core'。 – OlegTheCat

回答

1

如果你使用雷音嘗試運行lein install - 這應該使罐提供給您。

我在當前項目中使用相同的庫,我的project.cljns :require與您的相同。

+0

我必須嘗試過好幾次,但最終發生了一些變化,併發揮作用。謝謝。 – phlie