Last Updated: February 25, 2016
·
4.291K
· hsestupin

Import lein-project as intellij-idea module

The problem is that leiningen and IDE module are 2 different development environments with their own dependenices stack. So if you type

lein repl

than lein will include to the classpath all of your project.clj list of dependencies

But if you run your *.clj files from Intellij Idea with the help of La-Clojure plugin (https://github.com/JetBrains/la-clojure/tree/clojure-idea-12) than ofcourse dependencies pointed in project.clj will not be included to classpath.

This problem can be simply solved by importing leiningen project as maven-module. To do this type

lein pom

This command will create pom.xml which will contain all depencencies of your project.clj. Than in Intellij Idea -> File -> New module -> Import module from external model -> Maven -> choose path to pom.xml generated at previous step

Now your clojure scripts will be running with the same list of dependencies from lein and Intellij Idea.