Starting an Incanter Swank server with Leiningen

Kevin Nuckolls asked if the Swank server I set up using Maven in my previous post can be started using Leiningen instead. The answer is yes. It’s very simple, in fact.

You don’t need Maven, Git, or even to manually install Incanter. You just need to install Leiningen, as described in this post, and then create a project directory containing the following project.clj file:

(defproject incanter-swank "0.1.0"
  :description "A Swank Server for Incanter"
  :dependencies [[incanter "1.0-master-SNAPSHOT"]]
  :dev-dependencies [[leiningen/lein-swank "1.0.0-SNAPSHOT"]])

Next download Incanter and its dependencies with Leiningen,

$ lein deps

and start a Swank server.

$ lein swank

Now connect to it from Emacs using M-x slime-connect, as described in my previous post and that’s it.

[NOTE: The first time you build this project, you may see a error message like, java.util.zip.ZipException: duplicate entry. This is a problem I’ve recently been seeing with Leiningen builds, but the jar files that are produced are valid, and the message will not occur when starting the Swank server after the initial build. I am looking into this.]

4 responses to “Starting an Incanter Swank server with Leiningen

  1. lein uberjar fails for me, with
    java.util.zip.ZipException: duplicate entry: incanter/censored.clj (NO_SOURCE_FILE:0)

    I’d be grateful for any suggestions.

    • I’ve started seeing this error too recently too. The jar that is produced works correctly, try it out.

      Somehow Leiningen sees two copies of each Incanter source file and the jar application doesn’t like this and complains when it sees the copy. But the jar that is produced is valid.

      I need to look into this.

  2. At this moment I get the following error when running lein deps:

    1 required artifact is missing.
    for artifact:
    org.apache.maven:super-pom:jar:2.0

  3. I have it working with:

    (defproject clj-finance “0.0.1-SNAPSHOT”
    :description “FIXME: write”
    :dependencies [[incanter “1.2.3-SNAPSHOT”]]
    :dev-dependencies [[swank-clojure “1.2.1”]]
    :main main)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s