Clojure with Intellij - oliyh/learning-clojure GitHub Wiki

Clojure on Intellij is currently in a state of transition. It initially had reasonable support that quickly became outdated and unloved. The plugins are currently incompatible with the latest version of Intellij. A new project called Cursive is currently being developed but isn't in public release yet.

Pre-requesites

  1. You have completed "Hello World"

Install Intellij and Clojure plugins

  1. Download and install Intellij 12
  2. Run Intellij, and from Settings (Ctrl + Alt + S) > Plugins install "La Clojure" and "Leiningen"
  3. Restart Intellij
  4. Open the Settings dialogue again
  5. Search for Leiningen
  6. Point the Leiningen executable to where you installed Leiningen. The rest should fill in automatically
  7. If applicable ensure http_proxy and https_proxy are defined in your system environment variables - you may need to restart to get them to take effect.
set http_proxy=http://<username>:<password>@your.proxy:port
set https_proxy=http://<username>:<password>@your.proxy:port

Open a project

  1. git clone https://github.com/oliyh/learning-clojure.git
  2. File > Open project > select the directory where the project resides - it should be recognised as a Clojure project
  3. The Leiningen plugin should sync the dependencies - you should see them appear in the project pane
  4. You may need to configure the SDK for the project: Open Module settings (Ctrl + Alt + Shift + S) - SDKs - Add an installed JDK

Start a REPL

  1. Unless your key mappings are conflicted, press Ctrl + Shift + D (or Tools > Start Clojure Console) to start a REPL
  2. Open a Clojure source file e.g. core.clj
  3. Load it into your REPL using Ctrl + Shift + L (or Tools > Clojure REPL > Load file to REPL)
  4. Switch to the namespace used in the file, (in-ns 'learning-clojure.core)
  5. Execute a function (hello)
⚠️ **GitHub.com Fallback** ⚠️