Sonntag, 15. August 2010

Import a Clojure Leiningen Project into Eclipse

To import a leiningen project in the Eclipse IDE add the eclipse leiningen plugin in the project.clj as dev-dependency.


When you now invoke the command "lein help" there is a new task called eclipse. Invoke the leiningen task eclipse via "lein eclipse". The eclipse leiningen tasks creates the eclipse projects files ".project" and ".classpath".

Now you can import the project in the eclipse IDE, therefore you can use the import eclipse wizard. Therefore select "File->Import->Existing Project into Workspace" then click the next button and select the leiningen project as root directory now you can import the project via click on the finish button.


When you have installed the eclipse plugin counterclockwise you can know develop with syntax highlighting, run the project and debug the project from the eclipse IDE.



Links

Kommentare:

  1. The eclipse plugin is fine, but unfortunately it doesn't add the dev-dependencies to the project classpath.

    AntwortenLöschen
  2. That’s right. For me at the moment its OK because I have no dependencies, which I need in the eclipse project classpath.

    AntwortenLöschen
  3. Just adding lein-eclipse as dependency did not enabled this plugin for me. lein still showed that "eclipse" is not a task despite it being a dependency. So I had to install it explicitly with

    lein plugin install lein-eclipse "1.0.0"

    AntwortenLöschen
  4. Just found out that "lein deps" also downloads plugin but places it into project tree.

    AntwortenLöschen
  5. Hello, was just about to start a lein-eclipse project. Hopefully google helped me spot yours :-)

    Do you mind if I make a little bit more of publicity to it (when I've tested it at home of course ;), in the ccw wiki, ml, and also maybe in a second time in the lein ml itself ?

    AntwortenLöschen
  6. great. Thx for lein-eclipse. I went to this compojure example "https://github.com/weavejester/compojure/wiki/Getting-Started". Added [lein-eclipse "1.0.0"] to dev-dependencies and able to load it into eclipse/ccw.

    AntwortenLöschen
  7. That makes life so much easier, thanks!

    AntwortenLöschen
  8. Very useful it is! I found that I had to re-run "lein deps" after adding lein-eclipse to project.clj. Otherwise lein still didn't have the eclipse task. After that everything appears to work.

    AntwortenLöschen