2
votes

Clojure/Leiningen/Eclipse (and Java) newby. I'm trying to get Eclipse to load a Clojure/Leiningen project, and I'm seeing confusing/contradictory results searching for Lein plugin solutions.

Eclipse IDE for Java Developers Version: Juno Service Release 2 Build id: 20130225-0426 (Windows 8)

I've got the following user profile in .lein\profiles.clj

{:user {:plugins [ [lein-eclipse "1.0.0"]
]}}

And the following Leiningen project file:

(defproject firstclojureproj "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [
                [org.clojure/clojure "1.5.1"]
                [lein-eclipse "1.0.0"]
                ]
)

Doing a lein help I get the following (which I think is the root of my problem)

leiningen.eclipse  Problem loading: Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath:

Also when I attempt to Import / Existing Projects into Workspace / and select the folder with my Leiningen project, the folder appears grayed-out with a check box and I cannot select it.

3
Please check out this answer stackoverflow.com/questions/22127021/…Viktor K.

3 Answers

1
votes

The lein-eclipse plugin is a plugin to leiningen that produces eclipse project files. It goes in the :plugins section of the project.clj file.

:plugins [[lein-eclipse "x.y.z"]]

(assuming you are using lein 2.1.x+)

lein-eclipse "1.0.0" is hopelessly old (3 years) and won't work with a modern version of leiningen. There is a "2.0.0" version on clojars though I have not looked into it enough to know if it works better.

4
votes

There is no need for a special plugin.

Create a Maven pom-file:

→ lein pom
Wrote /home/jhoetzel/clojure/hellop/pom.xml

Use the Maven eclipse:eclipse goal to generate the Eclipse configuration files:

→ mvn eclipse:eclipse
[INFO] Wrote Eclipse project for "hellop" to /home/juergen/clojure/hellop.
2
votes

Add [no-man-is-an-island/lein-eclipse "2.0.0"] to your project.clj under :plugins. Then run:

>lein deps
>lein eclipse

Output should be:

Created .classpath
Created .project

You can now import your project folder as an "Existing project into workspace" in Eclipse (Counterclockwise).