This project is no longer actively maintained by me. If you’re looking for a Clojure development environment based
on IntelliJ and with Leiningen support, check out Cursive . If you want to add new
functionality to this plugin, feel free to fork and modify it as you like.
This plugin integrates Leiningen into IntelliJ. It is supposed to work with both the Ultimate and Community Edition
of IntelliJ.
- 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.
- 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 project from scratch and add a Plugin Module which points at the root directory of the intellij-leiningen-plugin source.
- When it asks for a Project SDK, point it at the Community Edition SDK you have just set up.
- Once the project and module have been created:
- Add the resources directory as a source root to the plugin module.
- Add the test directory as a test root to the plugin module.
- Setup the dependency on the leiningen interop library which is written in Clojure:
- Using leiningen 2.0 or higher, navigate on the command line to the interop subdirectory
- Run ‘lein uberjar’ – this will generate a standalone jar file.
- Add this jar to the plugin module’s dependency list
- Using leiningen 2.0 or higher, navigate on the command line to the interop subdirectory
- 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!
If you wish to add the interop module to the project do the following:
- Using leiningen 2.0 or higher, navigate on the command line to the interop subdirectory
- Run ‘lein pom’ – this will generate a pom.xml file.
- Navigate to the pom.xml file in IDEA’s project manager
- Right click on the pom.xml – Select ‘Add as Maven Project’
- Maven plugin needs to be enabled for this
- This will create a module named interop in your project
- Add this module as a module dependency to the plugin module.
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 into your IntelliJ plugins folder.
Patches can be submitted via email to janthomae at janthomae dot de or using GitHub’s fork and pull request facility.