Poor Man's Integrating Leiningen into Counterclockwise (Clojure's Eclipse IDE Plug-in)


Warning: This post is being resurrected from an old posterous blog.

The information is out of date and needs to be updated, as CCW is much more mature now. In the mean time, I will leave it up in case anyone finds it useful.


So, haven't you ever wished there were a plug-in for lein in Counterclockwise (ccw)? There isn't one that I know of, but we can get somewhat close to our goal with what I'll call a Poor Man's integration. All we have to do is use Eclipse's External Tools feature to call out to our lein functions.

Below are the instructions to make it so. Hopefully there are no glaring errors. If there are, let me know.

First, we create a new Clojure project in ccw:

As you can see, our new project is created:

Now click on Run -> External Tools -> External Tools Configuration:

And click on Program and then the New Configuration button at the top left:

Now you are going to want to do the following steps, with respect to the arrows as they go down the screen:

  • Give it a name of "new"
  • Browse to the location of the lein executable
  • In the Working Directory box, click the Variables button and pick the workspace-loc[ation] option
  • In the Arguments box, type "new" into the argument box and then click the Variable.. button and pick the project-name option
  • Click Apply

Now click over to the Refresh tab and check the Refresh box:

Now click over to the Common tab and check the box for External Tools under the Display in favorites menu section.

Also, click Apply and then click Run:

You should now see some extra files pop up on the Package exporer, like project.clj and src/MyTest/core.clj.

Now let's integrate the deps command. (for this, and all subsequent commands, ensure that you are not using the workspace_loc for the working directory)

Go gack into your External Tools Configuration menu and click on your new configuration. Now click the Copy button (which is next to the New button):

Now all you have to do is change the following

  • Change the name to deps
  • Change the Working Directory to project_loc
  • Change the Arguments to deps
  • Click Apply

For all the other commands (like compile, clean, run, etc.), just copy deps and change the Name and the Argument, and then Apply. Like for uberjar:

After you run new, deps and uberjar, your Package Explorer may look something like mine:

And that's it for now. They main thing I couldn't get to work smoothly was lein's repl command. It would be nice if there were some way to integrate it with ccw's nice repl.

Questions or comments, let me know!