This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-14
Channels
- # adventofcode (4)
- # announcements (11)
- # babashka (1)
- # beginners (45)
- # calva (31)
- # cider (12)
- # clj-kondo (1)
- # cljdoc (9)
- # cljs-dev (5)
- # cljsrn (11)
- # clojure (42)
- # clojure-australia (1)
- # clojure-germany (14)
- # clojure-italy (1)
- # clojurescript (20)
- # conjure (2)
- # cursive (11)
- # datomic (5)
- # emacs (2)
- # events (1)
- # fulcro (24)
- # graalvm (1)
- # honeysql (69)
- # malli (2)
- # off-topic (13)
- # reagent (12)
- # reitit (1)
- # shadow-cljs (14)
- # specter (2)
- # tools-deps (21)
- # uncomplicate (4)
I'm a little fuzzy on the distinction between clj
's -A
and -M
options. What exactly is a "main option" alias and how does it differ from normal aliases/"aliases of any kind"? (Side note: where did that diagram go with all the arrows labeled with the different CLI options? Could've sworn it was on the deps/cli reference page or the guide)
@ctamayo -A
is for invoking a REPL, -M
is for invoking clojure.main (typically with a -main
function with :main-args
), -X
is for executing a function, typically with pre-configured args in deps.edn.
so -M:some-alias -m my.project a b c
is like calling (my.project/-main a b c)
right? And :some-alias
presumably just adds extra stuff to the classpath that the my.project
ns needs?
Thanks! OK so I think something weird is happening. This has happened once or twice before - I forget where - but most recently on the datahike test suite: Commands that are documented with -M
fail with a FileNotFoundException
, but succeed when I use -A
instead. So for example running unit tests exactly as they are invoked by the helper scripts (https://github.com/replikativ/datahike/blob/development/bin/kaocha via https://github.com/replikativ/datahike/blob/development/bin/run-unittests) gives me:
$ TIMBRE_LEVEL=':fatal' clojure -M:test -m kaocha.runner --focus :clj
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate kaocha/runner__init.class, kaocha/runner.clj or kaocha/runner.cljc on classpath.
Full report at:
/tmp/clojure-16371792498407115921.edn
But switching to -A:test
works.@ctamayo That indicates the version of clojure
is too old.
clojure -Sdescribe
will tell you what version it is. You need at least 1.10.1.697 per https://clojure.org/releases/tools
In older versions of clojure
the -M
option did not respect :extra-deps
so part of the alias would not be pulled in (the dependencies), just the :main-opts
part.
clojure -h
displays the version (at the top of the help) as well as clojure -Sdescribe
It scrolls off the top of the screen for me so I tend to recommend clojure -Sdescribe
because the output is shorter.
I also had an embarrassingly old version (1.10.0.411) that didn't print that at the top. But I will remember that trick! And also take a break still. 😛
Also worth noting that the latest is 1.10.2.774 now that Clojure 1.10.2 is out (not 1.10.1.x).
Is there a way to find out which version of Jetty the installed Clojure tools are using?
@zane Jetty? I wouldn't expect the Clojure tools to be using a web server. Can you provide a bit more context?
If you mean "in a deps.edn
project, where Jetty is a transitive dependency", you can use clojure -Stree