Clojure Midje Project.clj给出错误

Clojure Midje Project.clj给出错误,clojure,midje,Clojure,Midje,我在我的环形服务器上看到一个错误,我从它开始 lein与配置文件开发环服务器 java.io.FileNotFoundException: Could not locate midje/sweet__init.class or midje/sweet.clj on classpath: , compiling:(news/routes/headlines_test.clj:1:1) ... 这是我的项目。clj: (defproject news "0.1.0-SNAPSHOT" :des

我在我的环形服务器上看到一个错误,我从它开始
lein与配置文件开发环服务器

java.io.FileNotFoundException: Could not locate midje/sweet__init.class or midje/sweet.clj on classpath: , compiling:(news/routes/headlines_test.clj:1:1)
...
这是我的项目。clj:

(defproject news "0.1.0-SNAPSHOT"
  :description "..."
  :url "https://herokuapp.com"
  :min-lein-version "2.0.0"

  :ring {:handler news.core.handler/app
         :init    news.core.handler/init}

  :dependencies [[org.clojure/clojure   "1.6.0"]
                 [compojure             "1.3.1"]
                 [ring/ring-defaults    "0.1.3"]
                 [liberator             "0.11.0"]
                 [cheshire              "5.3.1"]
                 [org.clojure/java.jdbc "0.3.6"]
                 [postgresql/postgresql "9.3-1102.jdbc41"]
                 [yesql                 "0.5.0-rc1"]
                 [environ               "1.0.0"]]

  :plugins [[lein-ring    "0.9.1"]
            [lein-environ "1.0.0"]]

  :profiles {:dev-default  {:dependencies [[ring/ring-devel           "1.3.1"]]}
             :test-default {:dependencies [[midje                     "1.6.3"]
                                          [javax.servlet/servlet-api  "2.5"]
                                          [ring-mock                  "0.1.5"]]
                            :plugins      [[lein-midje                "3.1.3"]]}
             :production-default {:ring {:open-browser? false
                                         :stacktraces?  false
                                         :auto-reload?  false}}

             ;; Set these in ./profiles.clj
             :dev-env-vars  {}
             :test-env-vars {}

             :dev  [:dev-default  :dev-env-vars]
             :test [:test-default :test-env-vars]
             :production [:production-default] })

我想我的困惑是:当我在开发环境中运行服务器时,为什么会出现关于midje的错误?

您需要使用
lein with profile+dev ring server
。如果将
lein与profile dev ring server一起使用(注意dev之前没有
+
),将使用dev概要文件,并替换默认值

有更多关于在不同配置文件处于活动状态时调用Leiningen的信息


您的src路径(news/routes/headlines\u test.clj)上似乎还有一个test clojure文件,可能需要midje。您需要将其从src中删除并放到另一个目录中,或者在调用lein-ring服务器时需要包含测试概要文件,即
lein-with-profile+dev,+test-ring-server

你可能对(莱因-)米杰有一种依赖,这种依赖源于负责这一点的解放者。它是前者(不包括加号)。测试文件位于正确的测试目录中。谢谢