tools-deps

wevrem 2026-05-16T21:09:09.423439Z

I'm reading the docs and if I include multiple aliases with -M and if each of those aliases has their own :main-opts defined in deps.edn then, as I understand it, the main options of the last alias will take precedence. But what if I also provide -m some-name-space on the command line? I want it to take precedence, basically I don't want any of the :main-opts of the aliases to be used at all, but that doesn't seem to be happening. The :main-opts of the last alias are taking effect, and I don't know what is happening to my command line stuff, I'm guessing they are being sent in as additional args. (Update, I just checked and yes they are showing up as extra args.) Is there a way to get my command-line main-opts to be the final final?

seancorfield 2026-05-16T22:01:57.071519Z

Here's how I deal with that: https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L30-L32

seancorfield 2026-05-16T22:02:24.284589Z

So you can use -M:some:thing:no-main -m some-name-space

wevrem 2026-05-16T22:37:17.210119Z

I had a guess that would be a way to do it. Thanks.

dpsutton 2026-05-17T00:05:39.400679Z

and if you need an “ad-hoc” version, you can use -Sdeps '{:aliases {:blank {:main-opts []}} -M:some:thing:blank -m some-name-space if you don’t want to leave it around in your deps edn. might be a useful one in the system level too. i’ve never run into this but it’s interesting. I’ve had the issue where where you can’t seem to ignore the :exec-fn if its present?

seancorfield 2026-05-17T00:43:16.110809Z

I would expect that if you use -X for :exec-fn and you have multiple aliases, the merging would cause the last :exec-fn to take precedence there? (can't say I've tried that tho')

dpsutton 2026-05-17T00:43:44.698469Z

no i think clj -A:test will run the exec function even though you specify A not X

dpsutton 2026-05-17T00:44:22.876459Z

no, that’s not it. i forget the issue i’ve had where i had to split extrapaths from the exec-fn. or perhaps the issue has been solved

dpsutton 2026-05-17T00:44:36.658849Z

maybe i’m misremembering 🙂