6

Consider the following (minimal) leiningen project

./project.clj:

(defproject repro "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [midje               "1.5.1"]])

./repro/src/repro/core.clj:

(ns repro.core)

./repro/test/repro/core_test.clj:

(ns repro.core-test
  (:require [repro.core  :refer :all]
            [midje.sweet :refer :all]))

(facts "about numbers"
       (fact "trivial"
         1 => 1) )

If I have the leiningen midje plugin installed, this runs at the command prompt as follows:

lein clean
lein midje
~~> All checks (1) succeeded.

However, if I import the leiningen project into Intellij 12.1.5 Community Edition, I get a fat stack trace:

Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
    ...
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333)
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:988)
at clojure.lang.Namespace.find(Namespace.java:188)
at clojure.core$find_ns.invoke(core.clj:3728)
at clojure.core$the_ns.invoke(core.clj:3760)
at clojure.core$ns_name.invoke(core.clj:3767)
at midje.Bootstrap$bootstrap.invoke(Bootstrap.clj:8)
at midje.sweet__init.load(Unknown Source)
at midje.sweet__init.<clinit>(Unknown Source)
... 37 more

Looks like La Clojure + Intellij can't find some of midje's prerequisites, which is odd, because La Clojure is running classpaths out of the leiningen .m2 directory.

I've looked for a midje plugin for Intellij, but no luck so far.

I need this because although I am happy to use just emacs + leiningen, my team wants Intellij.

Alex Miller
  • 69,183
  • 25
  • 122
  • 167
Reb.Cabin
  • 5,426
  • 3
  • 35
  • 64
  • 1
    importing a project works with [Cursive](https://cursive-ide.com/) (the new version of La Clojure) in IDEA 16, but still support for `midje` is rather poor - the expected right-click 'Run Tests' was not there. Manually adding `leiningen midje` run-configuration works though. – botchniaque May 09 '16 at 15:10

0 Answers0