Intellij has a remote debug Run Configuration that can be used with Clojure.
First add the following options to the jvm in the project.clj file:
:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5010"]
Where 5010 is port number to be specified in Intellij Remote Debug Configuration.
Then, in Intellij, go to Run -> Run... -> Edit Configurations...Use the + button and choose Remote. Give a name to the configuration, change the port to 5010 and click OK. Run the application using lein:
> lein ring server-headless
After the application is running, run (in Intellij) the Intellij Remote Debug Configuration you created. You will be able to setup breakpoints, run line by line, etc.
Without Leiningen
Another option is to drop leiningen and run the ring application as a Clojure Application in Cursive. You have to add a -main function:
(defn -main [] (run-jetty app {:port 8080})
app is the function where you define your routes and use as ring handler :ring {:handler xxx/app} in project.clj. You have to require [ring.adapter.jetty :refer [run-jetty]] and debug the file in Intellij as a Clojure Application.