Community projects for Clojure CLI tools
There are a number of tools from the Clojure community which add build tool features to the Clojure CLI tools. This enables developers to have a very lightweight and customisable set of tools that just do what they need.
This article just covers the very basics of each tool, see each projects documentation to get the full benefit of each tool.
- depot finds newer versions of libraries (from Clojars and Git repositories)
- kaocha full featured next gen Clojure test runner
- depstar to package up your application for the JVM platform
Development Workflow with Clojure CLI tools
Continuing our exploration with Clojure CLI tools, we will discuss what what templates are available to help us create project, Then we will create a new ClojureScript project using figwheel-main and show the different builds we can use to provide several workflows for developing, testing and deploying an application.
We will create a new project using the figwheel-main template, explaining that we need to specify organisation/project-name
or organisation.project-name
for the clj-new
templates to work properly.
Then run the project using the -A:fig:build
alias to run with rebel readline to our user account version of deps.edn
so it is available for all projects. Then we will run a test runner and see the auto-testing monitoring. Finally we will show ways to configure a deploy workflow that we can use with GitHub
Gaining confidence with Clojure CLI tools
We are going to try out the different command line options available as we continue our journey into the Clojure CLI tools..
We explore the different ways to running Clojure code, from a single expression to a full project. We include examples of aliases for optional configuration and combining aliases to create specific configurations when running a project. Finally we will see how to diagnose a project and understand potential sources of conflicts.
Continue reading →Newer content can be found in Using Clojure tools section of Practicalli Clojure
A deeper understanding of Clojure CLI tools
CLI tools make Clojure very accessible and simple to install as they are a essentially a wrapper for running Clojure code using the java
command and use additional libraries to manage dependencies, class paths, create projects and build java archive (jar) files.
Newer content can be found in Using Clojure tools section of Practicalli Clojure
Its quite common to use the java
command to run your code in production, usually defined in a shell script. Leiningen can be used to run your application in production too, however, because Leiningen creates 2 JVM instances (one for itself and one for the application), its more efficient to just use the java
command.
CIDER jack-in to Clojure CLI projects from Spacemacs
Running a Clojure project created with CLI tools or clj-new
may require you to pass in an alias for the REPL to pick up the right libraries.
A few days ago I created a new ClojureScript and reagent project, using the Clojure CLI tools and clj-new
project creation tool, which converts Leiningen and Boot templates into a deps.edn based project. Unfortunately when I created a project from the fighwheel-main template the REPL failed to run from CIDER using cider-jack-in-cljs
, saying that figwheel-main was not found. All that was required was to specify the :fig
alias when running a REPL.
This article covers two approaches to running Clojure CLI projects from CIDER jack-in that require setting of an alias or multiple aliases e.g. -A:fig:build:party:hammock