Question

I'm looking at switching my projects build from Ant to leiningen and wanted to know if there is a Clojure IDE (intellij, eclipse, netbeans) for which the "build" and "debug" buttons will still work?

Was it helpful?

Solution

I have had some luck with La Clojure and the "Leiningen" plugin for IntelliJ IDEA. After creating a new project on the command line with lein new, I created a new project in IntelliJ. The Run Configuration Script Path needs to be pointed to the core.clj file, and the Module Settings "Dependencies" need to include the lib directory as a "Module Library."

The Leiningen plugin offers the usual lein commands, so you can build your jar directly from the IDE (or from the shell). You can edit your project.clj file from IDEA, and the Run and Debug seem to work as well.

BTW, I also found this screencast very helpful for getting started with La Clojure.

OTHER TIPS

I've been using Eclipse and CounterClockwise plugin with Leiningen configured to be accessed via External Tools. As the blog post title says, it's a "Poor Man's Integration", but has worked for the example I've tried.

For debugging, syntax highlighting, and running clojure in Eclipse try:

  1. Download counterclockwise for syntax highlighting via external tools using the update site.

  2. Add [lein-eclipse "1.0.0"] to your dependencies in your project.clj file.

  3. Add the plugin manually with command: lein plugin install lein-eclipse "1.0.0". This step is included because just adding the dependency doesn’t always work.

  4. Run the command lein eclipse in project folder to generate eclipse .project and .classpath files. This step might take awhile. If it gets stuck, run it again. It should say "created .project and .classpath".

  5. Restart Eclipse.

  6. Go to |File -> Import -> General -> Existing Projects in Workspace| and select the project folder. You should be able to select the clojure project, debug and run it.

Notes: It doesn't seem to add the dev-dependencies to the project classpath. Also, you need to change your workspace to the folder with the project so it does not make a second copy of the project and uses the actual files.

It's hard to be definitive about this without going through the latest version of every IDE plugin for Clojure, but as someone who keeps up with both Leiningen and the general IDE related developments I have not seen this functionality anywhere. The words IDE, eclipse and netbeans have not been mentioned on the Leiningen google group either, and I would assume that if someone was working on this they would mention it there.

Leiningen is really easy to use on the command-line though, so don't be afraid to give it a try. I've been converting my projects to lein from using both ant and maven previously. The dependency tracking is really handy, and more plugins adding useful new commands are coming out every week. If you really need IDE integration one lightweight way to do it might be to add some kind of custom command command or button that just runs lein in the background.

The best integration I've found is with slime-clojure via lein-swank.

Basically, you use the lein swank command to start a swank server with a Leiningen-configured classpath. Then, you connect to that swank server using M-x slime-connect, and you've got the repl good to go. Well, so long as you can deal with emacs ;)

I've been using Intellij IDEA + La Clojure.

  1. Run lein pom to create a pom.xml file for Maven.
  2. Create a new project in Intellij IDEA and select create from Maven project.

When you change the dependencies with Leiningen, update the pom.xml.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top