Can I use Ubuntu for Clojure development

I want to learn Clojure and I want to use IntelliJ and the Cursive plugin.

Can I easily install all of these ?

Roelof


Solution 1:

Yes, you can (or in the case of Cursive soon be able to) instal these.

Clojure is available in the Universe repository, which should be enable by default. The most recent version available is 1.4, available in 13.10 and 14.04.

sudo apt-get install clojure1.4

12.04 has version 1.2.

sudo apt-get install clojure1.2

The most recent version of Clojure is 1.6. If you really need the newest version, you can download a binary in a jar file, which you can easily run from your home directory. It is also available in the official repositories from 15.04 onwards.

IntelliJ Idea is a commercial product, but Community edition is free. Even through it is free, it needs to purchased through the Software Center.

One note of warning, when starting IntelliJ you are likely to see a warning message saying that it should work with OpenJDK, but that it expects Oracle Java and that using OpenJDK is unsupported.

According to the Cursive website , is not yet available. It will be also be a commercial product, but they say it will work with the IntelliJ Community edition.

Solution 2:

It is not useful or necessary to load Clojure jar files as these will be loaded on demand by leiningen.

To get leiningen it's easier to get the lein script from the leiningen site. This will also help you get an up-to-date version of Leiningen.

Solution 3:

You only need to install the java JDK and Leiningen

sudo apt-get install openjdk-7-jdk leiningen

My setup is as following:

:~ > java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

:~ > lein -v
Leiningen 1.7.1 on Java 1.7.0_65 OpenJDK 64-Bit Server VM

If you want to use Clojure 1.6, use a project.clj file like this

(defproject MyAwesomeProject "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.6.0"]])

Cursive is not yet available so you have to use something else. My choice of IDE is Counterclockwise. It uses Leiningen to manage the dependancies so you have virtually nothing to do. When Intellij IDEA will have the Cursive plugin, you will be able to switch easily.

If you wish to update the dependancies manually, cd to your project directory and do

:~/Clojure/MyAwesomeProject > lein deps
Copying 18 files to /home/francois/Clojure/MyAwesomeProject/lib