The whole subject's a bit confusing,
and it's necessary to be really unambiguous when thinking about
what's going on.
You can attach IntelliJ debugging to a remote Java process by (i)
ensuring that remote process's JVM is accepting debug connections,
(ii) creating an Intellij Run Configuration which is of type
'Remote' and pointing to the remote process's JVM.
To do (i), it depends what the process is. If it's a NREPL
session started by 'lein repl', you need to start it with
JAVA_OPTS set something like this:
JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" lein repl
where 5005 is the Java debugger port you're going to use in the
next step.
To do (ii), use 'IntelliJ/Run/Edit
configurations.../Defaults/Remote' and adjust the Settings section
accordingly, using port 5005. The bits at the top of that
dialogue are read-only hints as to the configuration you will have
to give a remote process in order to attach to it.
Note that Cursive's facility 'IntelliJ/Run/Debug REPL for xxx' is
a shortcut which launches a REPL as in (i) then attaches the
debugger to it.
Jon