Build tools and package management
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.
There are multiple package management solutions for Clojure.
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
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.