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.
Build tools and package management#
Being hosted allows you to tap into existing ecosystems. As a Clojure developer, you have the full power of Java, JavaScript and .NET packages. But a good build tool is essential to wield this power.
There are multiple package management solutions for Clojure.
Leiningen#
Lein is one of the oldest and most mature build tools for Clojure. It's more than a build tool in the sense that it allows us to define dependencies and project-specific tasks. Think of Lein as the npm or Yarn of the Clojure ecosystem.
Lein lets you:
load JVM dependencies from the Maven repository
load JavaScript dependencies using a custom CLJSJS repository
package Clojure into JVM or JS apps
run a Clojure REPL
get support for Clojure CLR
There also exists support for generating projects using templates. The only downside to Lein is that it runs a new JVM instance for each app. This could become resource-intensive if your product consists of multiple Clojure apps.
Boot#
Boot is similar to scope in Lein, with one key difference. Boot only runs one instance of the JVM. This leads to better resource utilization.
This page is a preview of Tinycanva: Clojure for React Developers