Getting started with La Clojure on Windows

From IntelliJ-Wiki

Jump to: navigation, search

This guide takes you step by step through creating a La Clojure project using IntelliJ IDEA, La Clojure and Leiningen plugins.

Contents

Prerequisites

  • You are working with IntelliJ IDEA Community Edition or Ultimate Edition version 12 or higher.
  • Leiningen is installed on your computer.

Creating a Leiningen project

Outside of IntelliJ IDEA, perform the following lein command to create a new lein project:

lein new foobar

The new lein project foobar is created under the directory C:\lein_project:

File:lein_project.png

Open for editing the file project.clj, and specify the desired version of La Clojure:

File:clojure_version.png

Installing La Clojure and Leiningen plugins

1. Launch IntelliJ IDEA. To do that, just double-click the desktop shortcut icon File:ij_shortcut.png, or double-click idea.exe or idea.bat under the bin directory of your IntelliJ IDEA installation.

IntelliJ IDEA starts and displays the Welcome screen, where you click the link Configure:

File:Welcome_screen_Idea12.png

2. In the Configure page, click the link Plugins:

File:Welcome_screen_Idea12_plugins.png

3. Note that La Closure and Leiningen plugins are not bundled with IntelliJ IDEA. They should be downloaded from the Jetbrains repository and installed. This is how it's done:

In the Plugins dialogs box, click the button Browse repositories, to show the list of repository plugins.

Find the La Clojure plugin, download and install it:

File:install_plugin.png

Then, same way, download and install the Leiningen plugin.

When both plugins are installed, they appear in the list of available plugins. When you apply changes, IntelliJ IDEA prompts to restart, for the newly installed plugins to take effect:

File:restart.png

Opening project in IntelliJ IDEA

On the welcome screen, click Open Project:

File:open_project.png

Since La Clojure plugin has been installed, IntelliJ IDEA now recognizes the La Clojure projects:

File:open_project_laclojure.png

On clicking OK, IntelliJ IDEA opens the new project, and shows its structure in the Project tool window:

File:project_in_idea.png

Defining JDK

Try to run core.clj, and you will immediately get an error message: No jdk for module 'foobar'. So let us define a suitable JDK for the project.

To do that, click the Project Structure button on the main toolbar:

File:project_structure_in_idea.png

The Project Structure dialog opens the Project page, with the missing JDK. Click New, on the pop-up menu, choose JDK, and then select or preferred JDK on your file system:

File:set_up_jdk.png

Note that JDK you've just added as the project JDK, appears in the SDKs page of the Project Structure dialog. Open the SDKs page to explore the constituents of the selected JDK:

File:jdk_jars.png

Exploring module dependencies

This step is performed just for making sure that everything is OK. In the Project Structure dialog, open the Modules page, and click the tab Dependencies.

You see that Leiningen La Clojure version 1.5.1 is added as the module dependency:

File:explore_module_dependencies.png

You can also observe this library in the tree view of the external libraries in the Project tool window.

Personal tools