CIDER (Emacs)

CIDER (The Clojure Interactive Development Environment for Emacs that Rocks) functionality is largely build-tool-agnostic except for the startup (a.k.a "jack-in") process to start and connect to nREPL. In recent versions, this works with Gradle the same as it does for other build tools.

Once you’re jacked-in or connected, see CIDER’s documentation for usage information.

cider-javadoc does not require enrich-classpath to work with Gradle. Clojurephant will automatically add sources/javadoc JARs of your dependencies to the REPL classpath.

(Easiest) Jack-in (w/ dependencies)

For CIDER’s dependency injection to work to work, you need at least:




v20220731.522 from MELPA (or a release newer than v1.4.1).

As long as your Gradle build is using either or both of the dev.clojurephant.clojure or dev.clojurephant.clojurescript plugins, CIDER will handle the rest.

  1. Open Emacs

  2. Visit a Clojure file in your project

  3. Run M-x cider-jack-in-clj

CIDER will automatically inject the needed nREPL version and middleware, start the nREPL server, and connect to it.

(Manual) Add dependencies to your build

If you’re someone who (setq cider-inject-dependencies-at-jack-in nil), then here are the needed changes to manually configure your project for use with CIDER.

Build Config

dependencies {
  devImplementation 'cider:cider-nrepl:0.28.5'

clojureRepl {
  middleware = ['cider.nrepl/cider-middleware']

Jack-in (w/o dependencies)

  1. Open Emacs

  2. Visit a Clojure file in your project

  3. Run M-x cider-jack-in-clj

(or) Connect to already running REPL

Start your nREPL server.

$ ./gradlew clojureRepl

Optionally, omit the middleware from the build.gradle and include it on the commandline:

$ ./gradlew clojureRepl --middleware=cider.nrepl/cider-middleware

Then M-x cider-connect. CIDER should pick up the port via the .nrepl-port file.