Cursive (IntelliJ)

Intellij has its own Gradle support, so that will cover getting things imported and the ability to run ad-hoc Gradle tasks.

As of 2022-08-02, Cursive doesn’t have direct Gradle support, but it is generally compatible once the project is imported.

Once you’re connected to the REPL, see Cursive’s documentation for usage information.

Start your nREPL Server

Kick off the REPL task from the shell.

$ ./gradlew clojureRepl

This will create the standard .nrepl-port file in your project root once the nREPL server is running.

Connect to Remote REPL

Cursive refers to this as a "remote" REPL, just meaning that it didn’t start the REPL for you.

  1. In RunEdit Configurations

  2. Click the + to make a new configuration, choose Clojure REPLRemote REPL

  3. Fill in the Name, as desired (we’ll use Gradle REPL)

  4. Choose nREPL as the connection type

  5. Choose Use port from nREPL file

    1. Choose your project’s *.dev module as the Context Module

    2. Specify custom port file as ../../.nrepl-port (presuming you use the standard src/dev/clojure project layout)

  6. Click OK

Now start your Gradle REPL run configuration.

Success! Now you can continue using Cursive with your active REPL.