Using Clojure tools
The clojure
command provided by installing Clojure CLI tools can be used to evaluate code, run Clojure applications and start a REPL for a Clojure editor or a command line REPL UI.
Clojure CLI tools are extended by adding aliases for community tools, e.g. practicalli/clojure-deps-edn
Editor used for majority of developer workflows
A REPL connected Editor provides the richest developer workflow for Clojure
Common tasks for Clojure development
Commands to use for common tasks and where their aliases are included in Clojure CLI tools or require an alias (either in a project or user-wide deps.edn file).
Clojure CLI tools can also be used for evaluating an expressions or running Clojure from files as scripts, although these approaches are less common.
What version of Clojure CLI tools are installed?
The deps.edn
file allows you to specify a particular version of the Clojure language the REPL and project use. You can also evaluate *clojure-version*
in a REPL to see which version of the Clojure language is being used.
clojure -Sdescribe
will show you the version of the Clojure CLI tools that is currently installed.
clojure -Sverbose
will also show the version of Clojure CLI tools used and then run a REPL
Clojure CLI main flag options
The most used flags for the clojure
command
Which flag to use?
The -M flag should work with all community tools, at they are typically support the Clojure.main approach with free-form string options as arguments.
The -X
flag should be used for the new built-in aliases and for any tools supporting Clojure exec approach, with arguments passed as key/value pairs.
More tools should start adopting the -X
flag and supporting key/value arguments in future.