Fork me on GitHub

Why does clojure not warn about an unexisting :test alias?

[email protected] /tmp/p1 $ echo "{}"  > deps.edn
[email protected] /tmp/p1 $ clojure -Srepro -A:test
Clojure 1.10.1
user=> ^D
[email protected] /tmp/p1 $ clojure -Srepro -A:testx
WARNING: Specified aliases are undeclared: [:testx]
Clojure 1.10.1


Also, I figured it would be useful to have something like: clojure -CR:test to get the same as clojure -C:test -R:test: use case, I want to run a REPL with the same paths and deps as the :test alias, just not execute the main

Alex Miller (Clojure team)13:08:29

you can use clojure -A:test to do that

Alex Miller (Clojure team)13:08:07

oh, "and not execute the main" - well for that you need the -C / -R


I think :test exists in install deps?


indeed, in my install on Arch, in /usr/share/clojure/deps.edn it has test as an alias

Alex Miller (Clojure team)17:08:05

-Scp is an existing clj option btw


That's useful, but it only affects the runtime classpath. This feature is about overriding the classpath from which the uberjar is created, which makes it more flexible. The classpath can be generated from other tools like leiningen, boot, clojure, etc, whatever source.

Alex Miller (Clojure team)17:08:36

gotcha, might be something good to add to's uber stuff then :)

Janne Sauvala19:08:26

@alexmiller I keep hearing references to (since your Inside Clojure -post). Is there more detailed description of it somewhere already or can we expect something coming out soonish? šŸ™‚


I suspect the answers are "no" and "maybe" -- depending on your definition of "soon" šŸ™‚

Alex Miller (Clojure team)20:08:38

trying to pull together a lot of strands right now, not sure on timing yet

Janne Sauvala05:08:19

Gotcha. Iā€™m exited to hear could be a thing. I really enjoy working with tools.deps and the latest features look great :thumbsup::skin-tone-2:

Alex Miller (Clojure team)17:08:42

we would definitely like to encourage more use of -X - considering a bunch of additional features that may continue to make it more attractive for tools


Features like...? :)

Alex Miller (Clojure team)17:08:03

well, still designing :)

Alex Miller (Clojure team)18:08:26

but really trying to simplify invocation in several ways

šŸ‘ 3

Updating hf.depstar.uberjar:

(defn run
  "Generic entry point for all invocations.

  Can be used with `clojure -X`:

  In `:aliases`:

      :depstar {:extra-deps {seancorfield/depstar {:mvn/version ...}}}
      :uberjar {:fn hf.depstar.uberjar/run
                :args {:aot true :jar-type :uber}}

  Then run:

      clojure -R:depstar -X:uberjar :jar MyProject.jar :main-class project.core

  If the destination JAR file and main class are fixed, then could be
  added to `:args` in `deps.edn`:

      :depstar {:extra-deps {seancorfield/depstar {:mvn/version ...}}}
      :uberjar {:fn hf.depstar.uberjar/run
                :args {:aot true :jar MyProject.jar
                       :jar-type :uber :main-class project.core}}

  Both `:jar` and `:main-class` can be specified as symbols or strings."
It would be nice if -X acted like -R .. -X .. so you didn't have to also specify -R:depstar here and could have the :extra-deps in the :uberjar alias.

Alex Miller (Clojure team)18:08:39

what I'm working on right now is in that area


@seancorfield One other thing that came up in #beginners: the non-standard way of providing the name of the uberjar. It would be easier to compose if that could be done using a named parameter like --uberjar foo.jar


@borkdude Yeah, I'm making it :jar for the -X option and it will also be -J / --jar on the command-line (as well as just accepting the filename anywhere).


So @daniel415ā€™s example will work exactly as he would like.


OK, in light of earlier discussions, the develop branch of depstar has several new features requested this morning: support for clojure -X, support for overriding the classpath used for building the JAR, and reworked argument parsing so the JAR filename can be specified "anywhere" (before/after/in the middle of the options). Please take it for a spin and report back any issues (either on GitHub or here). seancorfield/depstar {:git/url "" :sha "c461ba830e069edf0f011169c18595a4a8f917fc"} Thanks in advance