Clj cli tools workflow


I’m using clojure cli more often, and I’m curious about your setup and workflow. Mine is this:

  1. In ~/.clojure/deps.edn I have an user alias:

     {:user {:extra-deps {vvvvalvalval/scope-capture  {:mvn/version "0.3.2"}
                          com.gfredericks/dot-slash-2 {:mvn/version "0.1.5"}
                          com.gfredericks/repl-utils  {:mvn/version "0.2.17"}}
             :extra-paths ["/path/to/user-dir"]}}}

    In the :extra-paths I only have a user.clj file, where I created some helper functions I want to use during development on all my projects. It also looks for other user.clj files in the classpath and load them. My user.clj

  2. If I want to have some specific helpers for only one project, I create an user.clj local to the project. Here I also have the opportunity to override some parts of my global user.clj, if I wanted. From the command line, I start the project with clj -A:user:dev, where user is the alias from my global deps.edn and dev is an alias from my current project.

I have more aliases, like nrepl, which is adding other user.clj file to the classpath to start a nrepl server. In that case I’ll start clj with clj -A:user:nrepl:dev. Relevant parts of my deps.edn.

What do you think about this setup? How it’s yours?

BTW, there was a similar topic: Deps.edn workflows, but it’s closed and I cannot post there.


For my general project workflows, there’s this

For our monorepo at work, we have a specific “subproject” containing our master deps.edn file and then each subproject has its own deps.edn file that depends on the master file for aliases and overrides. We run clj within a subproject like this:

CLJ_CONFIG=../versions clj -A:what:ever:aliases and extra arguments

(where ../versions/deps.edn is the master file).

Many of my personal aliases above are duplicated into our master file, sometimes in a modified form, so all team members have the same set of tools available.

We do not use user.clj anywhere. We have specific aliases that add dev or build subprojects to the classpath to bring in code to do stuff like start REPLs (some team members use nREPL, some use Socket REPL, some use REBL, etc), build artifacts (we use my fork of depstar), etc.