Clojure Build Tools - Leiningen, Boot, Shadow CLJS & Figwheel

Since Clojure is hosted, it can tap into ecosystems of other languages. This has led to multiple build tools for different ecosystems. Choosing the right build tool might get tough for a beginner as the pros and cons might not be known. In this module, we'll learn about the general state of build tools in Clojure and choose the right tool for our project.

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

Table of Contents

This lesson preview is part of the Tinycanva: Clojure for React Developers course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.

This video is available to students only
Unlock This Course

Get unlimited access to Tinycanva: Clojure for React Developers, plus 70+ \newline books, guides and courses with the \newline Pro subscription.

Thumbnail for the \newline course Tinycanva: Clojure for React Developers

Closure gives you the power to tap into existing ecosystems, but to wield that power, we need a build tool. There are many build tools available, and we'll walk through the famous ones, understanding their pros and cons. The oldest and probably the most mature is line-in-game, or line-in-shot. It helps you manage dependencies and project-specific tasks similar to NBM scripts. It is particularly suited to JVM dependencies, but can also be modified to work with JavaScript dependencies from the CLJS JS repo. Line-in-game has built-in support to package your app into jar files or JavaScript files, and it can also run a repo for you. The only downside is that line-in-game runs one JVM process for every application. If you have a large project with multiple sub-applications, you'll have to run one JVM instance to run each application. Boot is similar to line and scope, with the added advantage that it only runs one JVM for multiple applications. With Boot, you might have 15 applications running, but only one instance of the JVM will be used. Boot configuration is more verbose than line-in-game, and some people prefer it because of that. The official solution to manage dependencies is DEPS CLI. It is not as mature or as old as boot or line, but it is the recommended way going forward. It is focused on manning JVM dependencies, but can also be used with JavaScript . Unlike line-in-game or boot, DEPS CLI is more of a do-it-yourself solution. DEPS CLI give you the ability to pick your components and mix and match them as you see fit. The CLJ command that we have been using so far is a part of DEPS CLI. Line, boot and DEPS are more focused on the JVM aspect of the closure, but ShadowCLJS is optimized for JavaScript. Shadow lets you seamlessly inter-rop with NPM packages. You can yarn-install any package from NPM as you would in a JavaScript project and import it in your closure code. Just like line, Shadow also helps you package your application and run a repo, and along with that, it also has some JavaScript-specific development tools that help with hot module reloading, code splitting and dynamic imports. There also exists an extension for line called Figwheel that adapts line-in- game for JavaScript development. It introduces features like hot module reloading, code splitting and a few other things to line-in-game. Although there are many build tools to choose from, depending on the runtime you want to target, the basic principles remain the same. If you get a hang of fun build tools, you can easily use all others. On the JVM side, you cannot go wrong with either of the three options, but on JavaScript side, we recommend that you use Shadow.