2016-11-11 15 views
0

테스트를 위해 Midje 라이브러리를 사용하는 Leiningen 프로젝트가 있습니다. Howerver 나는 그래서 내가 잘못 종속성 dev 프로파일을 정의하기 때문에이 추측 lein test의 경우 나는 와 교대로Midje 테스트를 실행하는 동안 FileNotFound 예외가 발생했습니다.

java.io.FileNotFoundException: Could not locate midje/sweet__init.class or midje/sweet.clj on classpath 

또는를 얻을 나는

java.io.FileNotFoundException: Could not locate midje/util/ecosystem__init.class or midje/util/ecosystem.clj on classpath 

를 얻을 수있는 테스트를 실행할 수 없습니다입니다 그러나 나는 진짜 문제가 어디에 있는지 모른다.

는 보너스로, 나는 또한, 나는 항상 내가 (이뿐만 아니라 동일한 문제가있을 수 있습니다)에 env지도에서 일부 속성을 끌어 할 nil 얻고있다 environ 작업을 얻을 수 없습니다.

project.clj

(defproject 
    project 
    "0.1.0-SNAPSHOT" 
    :dependencies 
    [[org.clojure/clojure "1.8.0"] 
    [environ "1.1.0"] 
    ;; other deps, midje is not there 
    :repl-options 
     {:init-ns mailing.repl} 
    :jvm-opts 
     ["-server"] 
    :plugins 
     [[lein-ring "0.8.13"] 
     [lein-environ "1.0.0"] 
     [lein-ancient "0.5.5"] 
     [migratus-lein "0.4.2"]] 
    :ring 
    {:handler mailing.handler/app, 
    :init mailing.handler/init, 
    :destroy mailing.handler/destroy} 
    :profiles 
     {:uberjar {:omit-source true, :env {:production true}, :aot :all}, 
     :production 
     {:ring {:open-browser? false, :stacktraces? false, :auto-reload? false}}, 
     {:dev 
     {:env 
      {:db-user "user" 
      :db-password "psswd" 
      :db-classname "org.postgresql.Driver" 
      :db-subprotocol "postgresql" 
      :db-subname "//localhost/mailer"}}} 
     {:dependencies 
[[ring-mock "0.1.5"] 
[ring/ring-devel "1.3.1"] 
[midje "1.6.3"]], 
:env {:dev true}}} 
    :migratus { 
     :store :database 
     :migration-dir "migrations" 
     :db { 
       :classname "org.postgresql.Driver" 
       :subprotocol "postgresql" 
       :subname "//localhost/mailer" 
       :user "usr" 
       :password "psswd"}} 
;; refer to user and psswd from project 
:min-lein-version "2.0.0") 
+0

개발 의존성이 : dev 프로필 블록 안에있는 것처럼 보이지 않습니다. – jszakmeister

+0

그래, 나도 알아 챘지만, 거기에 넣으면'Map Literal은 짝수 개의 양식을 포함해야한다. ' 따라서 올바른 구문이 무엇인지 확실하지 않습니다 –

답변

1

나는이 시도하지했지만, 구조가 아주 잘 나타나지 않습니다. 그것은 상단에 귀하의 :dependecies 블록처럼 보이는

(defproject project "0.1.0-SNAPSHOT" 
    :dependencies [[org.clojure/clojure "1.8.0"] 
       [environ "1.1.0"]] 
    ;; other deps, midje is not there 
    :repl-options {:init-ns mailing.repl} 
    :jvm-opts ["-server"] 
    :plugins [[lein-ring "0.8.13"] 
      [lein-environ "1.0.0"] 
      [lein-ancient "0.5.5"] 
      [migratus-lein "0.4.2"]] 
    :ring {:handler mailing.handler/app 
     :init mailing.handler/init 
     :destroy mailing.handler/destroy} 
    :profiles {:uberjar {:omit-source true 
         :env {:production true} 
         :aot :all} 
      :production {:ring {:open-browser? false 
           :stacktraces? false 
           :auto-reload? false}} 
      :dev {:env {:db-user "user" 
         :db-password "psswd" 
         :db-classname "org.postgresql.Driver" 
         :db-subprotocol "postgresql" 
         :db-subname "//localhost/mailer" 
         :dev true} 
        :dependencies [[ring-mock "0.1.5"] 
            [ring/ring-devel "1.3.1"] 
            [midje "1.6.3"]]}} 
    :migratus {:store :database 
      :migration-dir "migrations" 
      :db {:classname "org.postgresql.Driver" 
        :subprotocol "postgresql" 
        :subname "//localhost/mailer" 
        :user "usr" 
        :password "psswd"}} 

    ;; refer to user and psswd from project 
    :min-lein-version "2.0.0") 

이 (폐문 ]) 잘못된 없으며, 개발 종속성이 실제로 :dev 프로필과 연결되지 않은 : 나는 뭔가를해야한다고 생각합니다. :migratus:dev 프로필에 속했는지 여부는 확실하지 않으므로 위의 예에서 프로필 외부에 있습니다.

FWIW, Leiningen의 레포에있는 sample project 파일은 유용한 리소스입니다.

+0

조언을 따르려고했지만 오류는 동일하게 유지됩니다. http://pastebin.com/9uLX038t –

+0

위의 예제로 작업 해 보았습니까? 그렇지 않다면 첫 번째': dependencies' 블록을 수정하지 않았을 수도 있습니다. 이것은 또한 문제입니다. 또한, 더 작은 예제로 사용할 수 있습니까? 그렇다면 조금 후에 살펴보고 도움을받을 수 있습니다. 그 밖의 최선의 충고는 최소한의 새로운'defproject' 블록을 만들고, 무언가를 얻은 다음 거기에서 빌드 할 수 있는지 확인하는 것입니다. – jszakmeister

+0

네, 여기에 물어보기도 전에 들여다 보았던 리소스입니다. 몇 시간 동안 설정을 해보았습니다. 그렇기 때문에 나는 정말로 Midje가 실제로 존재한다는 것을 Leiningen에게 납득시키는 법을 정말로 모르기 때문에 그렇게 갔다. 하지만 덜 복잡한 설정으로 시도해 보겠습니다. 감사합니다. –