Clojure and Clojure CLI
- running Clojure code (applications and tools)
- starting a REPL process (Read-Eval-Print Loop) for interactive development with a Clojure editor or a command line REPL UI.
- managing dependencies (via tools.deps) and downloads from Maven and Git repositories
The Clojure CLI is extended by adding aliases for community libraries and tools, e.g. practicalli/clojure-deps-edn
Common tasks for Clojure development
clojure -M:lib/hotload:repl/rebel runs a rich terminal UI REPL which can use add-libs to hotload dependencies into a running REPL process.
Clojure CLI version
-Sverbose flag shows the Clojure CLI version and basic configuration before running any task, e.g.
clojure -Sverbose -M:repl/rebel will show the Clojure CLI details and then run Rebel terminal UI.
Clojure CLI execution option flags
Which flag to use?
-X flag is used to call a fully qualified function, which can be any function on the command line. Arguments are passed as key/value pairs and strings / collection syntax should be escaped with single quotes.
-X can use
:replace-paths values to remove project
-T flag removes project paths and deps, so is run independent of a Clojure project configuration. Tools can be installed and referred to by name, or used via an alias name and have default configuration attached.
Read the article: Clojure CLI - which execution option to use
Which version of Clojure
org.clojure/clojure in the project
deps.edn file allows specification of a particular version of the Clojure language. The Clojure CLI also has a default version of the Clojure dependency, which is used if no other dependency is specified.