ERROR: cannot resolve symbol clojure -- Clojure into Java with IntelliJ IDEA

The post “Invoking Clojure code from Java” demonstrates what I understand to be the “right” way to bring code from a Clojure project into a Java project, but it does not show how to configure IntelliJ to use a Clojure library. (The gen-class macro can also be used, but that does not provide as clean of a separation of concerns because it forces you to put Java code in your Clojure project.)

PROBLEM: When typing “import clojure.lang.*” IntelliJ makes the text for the word clojure appear in red and provides the error “cannot resolve symbol clojure” when hovering the mouse over the red clojure.

SOLUTION: From the project settings (File > Project Structure (OSX) Ctrl + Alt + Shift + S (Windows)) select Libraries, click the + at the top left of the window. Select “from Maven” and search for clojure. Select the version you want to use (i.e. 1.5.0) and ensure that the path is correct (should point to the lib/ directory in your project tree) and hit OK. The package should allow you to now follow the instructions above to invoke Clojure code in your Java project.