Navigate to Definition or F3 in Eclipse counterclockwise

I believe I lost many people’s attention during my live coding sessions with Clojure and the Eclipse plugin for Clojure development – counterclockwise as I used to not get the feature Navigate to Definition or just hovering over a symbol with the Cmd key working in Eclipse.

I didn’t care much as Eclipse was an IDE that I didn’t spend much time with while developing applications in Clojure. It was Clojure’s REPL where I spent most of the time. On the other hand, I was asked to show the IDE support for Clojure and Eclipse was presented.

Whenever I hovered over a symbol the error message “You need a running Clojure VM” was shown.

I couldn’t fix it for long time until today.

Have all the dependencies of your Clojure project defined in Eclipse. I use leiningen 2 which used to download the dependencies into lib and lib/dev directories (in the version 1), but it doesn’t anymore so I had to use the pom task which “Writes a pom.xml file to disk for Maven interoperability.” (from lein2 help pom).

Once pom.xml is generated, import the project into Eclipse using Import > Maven > Existing Maven Projects.

After a while, when the compilation is done, from the context menu (under the right mouse button) of the project, select Run As > Clojure Application.

If no problems are encountered, the nREPL view is displayed and symbols are easily resolvable with the feature “Navigate to Definition”. Alternatively, you can use the key F3.

Check it out and report how it works for you.

Be Sociable, Share!
This entry was posted in Languages.

4 Responses to Navigate to Definition or F3 in Eclipse counterclockwise

  1. Phil says:

    You shouldn’t need the pom, or the eclipse maven support. CCW now supports lein. If you have a clojure project with a project.clj, you can right click on your project and say “Configure/Convert to Leiningen Project”. A “Leinnigen Dependencies” node will appear in the package explorer, and all will be good.

    BTW, lein2 resolves dependencies directly from your local maven repository (.m2/repository), so doesn’t need to copy them into the local project. You’ll see this if you expand Leiningen Dependencies.

Leave a Reply

%d bloggers like this: