Search This Blog

Thursday, September 30, 2010

Clojure 1.3 alpha release : A pom.xml to try it out with

There's a new version 1.3 of clojure in alpha release:

To try it out, install maven, create a file pom.xml as below, and then use $ mvn clojure:repl


This should start a clojure 1.3 REPL with editing and history provided by the jLine library. Have fun.

If you're already using emacs and slime, then all you have to do is $ mvn clojure:swank to start the clojure end, and M-x slime-connect to connect emacs to the running server.

If you'd like to use emacs, but don't know how to configure it to work with clojure, then there are complete instructions here, which I've just tested on a brand new account, and which still work fine. Emacs moans a bit during the install, as is its wont, but everything works nevertheless.

Only the file pom.xml needs to change to get the 1.3 alpha release working instead of 1.2 using these instructions.

Shawn comments below that this even works on Windows nowadays if you can install maven.

 If anyone else has success or trouble on any platform please comment below.


<project>

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>clojure-bleeding-edge</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>clojure-bleeding-edge</name>
  <description>clojure-bleeding-edge</description>


  <repositories>
    <repository>
      <id>central</id>
      <url>http://repo1.maven.org/maven2</url>
    </repository>
    <repository>
      <id>clojure</id>
      <url>http://build.clojure.org/releases</url>
    </repository>
    <repository>
      <id>clojars</id>
      <url>http://clojars.org/repo/</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure</artifactId>
      <version>1.3.0-alpha1</version>
    </dependency>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure-contrib</artifactId>
      <version>1.2.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>jline</groupId>
      <artifactId>jline</artifactId>
      <version>0.9.94</version>
    </dependency>
    <dependency>
      <groupId>swank-clojure</groupId>
      <artifactId>swank-clojure</artifactId>
      <version>1.3.0-SNAPSHOT</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.theoryinpractise</groupId>
        <artifactId>clojure-maven-plugin</artifactId>
        <version>1.3.4</version>
      </plugin>
    </plugins>
  </build>
  
</project>

5 comments:

  1. Confirmed, this works fine on Windows. However, you need to add the clojars repository in order to get swank-clojure to download.

    ReplyDelete
  2. Thanks Shawn, I thought I'd tested it in a clean account, but obviously not. When I retried it I found that I needed clojars for both the swank and contrib snapshots.

    Great news that it works on Windows. Do let me know if you have any problems. I am keen to see clojure spread beyond its home environment.

    Did you have any problems installing maven emacs or slime? Does the ELPA stuff work, or do you have to do it by hand?

    ReplyDelete
  3. Shoot, I spoke too boldly. I made that comment after testing only mvn clojure:repl, which worked fine. I thought mvn clojure:swank would follow, but I'm getting an error in the console window on that one. Not sure what's up.

    To your other questions, I've had maven, emacs, and slime working for years on Windows. Maven is simply a matter of downloading the zip, putting the batch file on the PATH, and setting M2_HOME. I've set up clojure-mode and slime by hand, with ELPA (requires a package.el patch on Windows: https://gist.github.com/12a4fd50023e84e6f353), and with leiningen. The current recommendation seems to be to install clojure-mode and slime with ELPA and launch swank-clojure via leiningen or maven.

    ReplyDelete
  4. Oh, a shame. I literally don't have a Windows installation so I can't try to fix this.

    Is it just a problem using this experimental pom for 1.3-alpha or is it broken with released versions?

    ReplyDelete
  5. It's a problem with mvn clojure:swank and quoting. I sent this patch to talios: http://gist.github.com/607688.

    ReplyDelete

Followers