The IntelliJ Leiningen Plugin
This plugin integrates Leiningen into IntelliJ. It is supposed to work with both the Ultimate and Community Edition
- Import leiningen projects into IntelliJ IDEA.
- Directly open a leiningen project file (just like you can open maven POMs).
- Dependencies from the leiningen project file are set up as libraries in IntelliJ.
- Run the mostly used actions (like compile, jar, uberjar, etc.) with a single click.
- Create run configurations for less used or parametrized actions.
Install the plugin via the plugin manager of IntelliJ. Then go to Settings > Leiningen and set up the location of
Leiningen. Now you can run Leiningen targets in the Leiningen tool window on the right side of the IntelliJ main
window by doubleclicking on the target name.
When you open a project that has a project.clj file in it’s root, it is automatically added to the list of
Leiningen projects in the Leiningen tool window. If you have multiple project.clj files in your project tree (e.g. a
project with subprojects) you can add these manually by pressing the plus icon in the Leiningen tool window.
Compiling the source code
- Grab the latest version from http://github.com/derkork/intellij-leiningen-plugin.
- Setup an IntelliJ SDK
- I suggest using an IntelliJ Community Edition as SDK base, to ensure that the plugin will run on the Community Edition as well.
- Create a new empty project: File→New Project, select Empty Project and select the directory where you left the code.
- When it opens the Project Structure window, click + and select Import Module. Select leiningenplugin.iml.
- Select Project SDK for the module, and in the Project tab select your SDK.
- Open the Leiningen toolwindow, and click +. Select the project.clj.
- In Settings→Compiler→Clojure Compiler set:
- Compile Clojure files to no
- Copy Clojure source files to yes
- In Settings→Compiler:
- If you have Use external build set, change the Resource pattern from !?.clj to ?.clj
- Add a new Plugin Run Configuration to the project and tell it to use the classpath of your plugin module
- Run the plugin using the configuration you just created!
Building the plugin distribution
To build a deployable Jar file:
- From the program menus, select Build → Prepare plugin-module [plugin-module-name] for Deployment.
- This will create a Jar file that you can deploy using Plugins→Install plugin from disk.
Patches can be submitted via email to janthomae at janthomae dot de or using GitHub’s fork and pull request facility.