Fork me on GitHub

Just in case anyone wants to know how to run tests using build.clj (instead of clojure -M:test or clojure -X:test as a separate step), I have added an example to next.jdbc's repo, since it uses a barebones invocation of the Cognitect test-runner: so you do clojure -T:build run-tests


(this is only really useful if you want a build command that runs your tests as part of a bunch of other stuff -- otherwise you're just spinning up a subprocess for no good reason)

💯 7

Note: this is not a -X-style invocation of test-runner (even though clojure -X:test is how I normally run tests in that project)!


I'm getting this error when my deps.edn includes `

techascent/  {:mvn/version "6.001"}
I've tried deleting my entire .m2/repository directory but the error reoccurs. Any idea what's going on?


@markaddleman try adding -Sthreads 1 to your CLI invocation.


FWIW, clojure -Sdeps '{:deps {techascent/ {:mvn/version "6.001"}}}' works fine for me so there's no inherent problem with that lib.


Thanks. I'm getting a new error now:

Error building classpath. Could not transfer artifact args4j:args4j:jar:2.0.26 from/to central (): status code: 416, reason phrase: Range Not Satisfiable (416)
I think I've made progress


I'm also on very spotty wi-fi so I


So I'll try again when I get home


Ah, spotty wifi. Yeah, definitely -Sthreads 1. And you may need to delete your ~/.m2/repository and start fresh to avoid corrupted files.


-Sthreads 1 did the trick. Thanks!

Jeff Evans14:08:24

is it possible to specify BOM dependencies via deps.edn ? ex:


@jeffrey.wayne.evans No, not currently. You have to specify all the components of the BOM explicitly instead. I suspect this would get a lot of upvotes if it was posted on

👍 4

Suppose you have a few aliases "alias1, alias2, etc" and a main entry point "foo", how would you invoke this? I would think clojure -A:alias1:alias2 -M foo ? Or do you just clojure -M:alias1:alias2:foo? Is there a difference, or one to be preferred over another?


(foo here is an alias that specifies :main-opts


I would use the second format.


do you have a reason for that? just preference, unambiguous merging of main opts, etc?


I pretty much only use -A now if I'm starting a REPL or have a very specific use case where -A is the right approach, e.g., clojure -A:deps -Tnew help/doc


I see. This is for a coworker that needs an nrepl main so it kinda feels the same as that to me: clojure -A:dev -M:nrepl kinda feels the same


I've always used just one flag and a concatenated list of aliases...


I think it's just personal preference. I find a single flag option "clearer" in that you immediately see "I run a -main" or "I run exec function" (or "I start a REPL") -- -M or -X (or -A).


yeah. i guess i like the other version for precisely that reason clojure -A:classpath-additions -M entrypoint


ok. well as long as its not wrong 🙂


The docs seem to encourage my style:

clojure [clj-opt*] -X[aliases] [a/fn] [kpath v]* kv-map?
clojure [clj-opt*] -M[aliases] [main-opts]


that's a good point. I guess i was thinking of when the changeover happens such that -A will no longer allow main options to "win".


but i think you've convinced me now that it is wrong, but perhaps happens to work


Also, where it describes how various options (in deps.edn) are provided, it says "should be provided as an alias in one of the deps sources and provided to the Clojure tools using -A (for REPL invocation), -X (for function execution), or -M (for clojure.main execution)." which reads to me as "you use either -A or -X or -M" (even though you can provide -A and either -X or -M).

👍 2

@dpsutton RE tooling, I'm not sure what cider's opts are atm, but I have been thinking about switching my setup over to taking a list of aliases which are passed to -A as you can't combine -M or -X with the nrepl start code anyway. The downside to that is how main-opts concatenate, so I can have an alias containing :main-opts ["-i", "init.clj"] to inject some startup code, but I suppose -M:user:provided:aliases is just as valid so it's probably OK.


cider used to use just trailing main args with -M -m nrepl/cmdline host port but if there were any profiles in the provided aliases those would actually dominate. so now it uses inline -Sdeps {:cider/nrepl {:main-args ..}} and then adds the profile cider/nrepl as the last profile so it wins under any strategy