i have an alias defined in my deps.edn
as follows:
:ion-dev
{:extra-deps {com.datomic/ion-dev {:mvn/version "0.9.276"}}
:main-opts ["-m" "datomic.ion.dev"]}}
if i run /nix/store/6n60jkgpxb1a95wjx3ikhn9nvp5w33yh-clojure-1.10.1.727/bin/clojure -A:ion-dev -Sdeps '{:deps {nrepl {:mvn/version "0.8.0"}...' -m nrepl.cmdline ...
it complains
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
WARNING: When invoking clojure.main, use -M
does this mean
1. i have to move the :main-opts
into a different alias?
2. the command line should have a -M
(without any aliases as a parameter) if i just want to run clojure.main
?im wondering what should be the naming convention for aliases in cases when one want to use some extra dependency both as just a library and as a command-line tool...
-A:ion-dev -M:ion-dev/run
maybe?
am i supposed to combine aliases which doesn't contain :main-opts
with aliases which does?
like -M:ion-dev:ion-dev/run
?
when my deps.edn
has:
:ion-dev
{:extra-deps {com.datomic/ion-dev {:mvn/version "0.9.276"}}}
:ion-dev/run
{:main-opts ["-m" "datomic.ion.dev"]}}
@onetom needs a -M
before the -m
, so clojure -A:ion-dev -Sdeps … -M -m nrepl.cmdline …
@onetom it is not required to have separate aliases, you can use the original :ion-dev
alias and just use -M
instead of -A
. However, the -M
(and -A
flags) should come after the -Sdeps
option and before the -m
option (the -A
flag does still work out of position though)
clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.0"}...' -M:ion-dev -m nrepl.cmdline
It is also possible to chain the aliases under -M
, especially if there is an alias for nrepl too (this example taken from https://github.com/practicalli/clojure-deps-edn/)
:middleware/nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.8.2"}}
:main-opts ["-m" "nrepl.cmdline"]}
And then simplify the command
clojure -M:ion-dev:middleware/nrepl
sure, but i need the :extra-path
in :ion-dev
on its own too, without the :main-opts
and so far i haven't found any option combination which wouldn't print some kind of warnings.
i went thru the new deps and cli docs and found this section: https://clojure.org/reference/deps_and_cli#_replace_project_environment_tool but it's unclear to me what does `tool` process refer to.
:replace-deps
will just use the deps specified in the alias, dropping any libraries from the main :deps
section. This is useful if you just want to run an external tool, e.g. such as clj-new that creates a new Clojure project.
Using the -M
option only calls the main namespace from the last alias in a chain, so with -M:ion-dev:middleware/nrepl
only the main namespace from :middleware/nrep
is called and the :ion-dev
is simply adding the library as an additional dependency.
I didnt see any other main namespaces on the example shared.
I am not clear on why an :icon-dev
with only extra paths is required in the scenario shared so far.
to start a development repl (with cursive or cider)
but i want to retain the option of running datomic.ion.dev/-main
, since that's the official way to deploy datomic cloud projects.
when i have a repl running already (started with repl related :main-opts
), im just using datomic.ion.dev/{push,deploy,deploy-status}
directly
There is no option to use the extra-deps but not the main-opts from an alias
You should separate those into two separate aliases if you need that
Something in my deps is using a version range or SNAPSHOT because every time I run clj
, it runs
Downloading: com/amazonaws/aws-java-sdk-cloudwatch/maven-metadata.xml
. Is there a clj
command that will help me find which dep that is?it’s not -Strace
or -Stree
, because those only tell me the resolved version
if you do tree, it's probably whatever is above that dep in the tree ?
I don't think I have any other magic command to tell you more unfortunately
that helps some, thanks
I was able to find the dep depending on cloudwatch (amazonica), but something else is causing
Downloading: org/clojure/clojure/maven-metadata.xml
. I guess I can wipe out ~/.m2/repository and do some greppingalternately, use -Sdeps '{:mvn/local-repo "tmp"}'
build up a new tmp repository instead
found it. de.kotka/lazymap specifies:
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>[1.2,1.6)</version>
<scope>compile</scope>
</dependency>
should that always trigger a snapshot check?
all version ranges will trigger a resolution to the "newest" stable version
even when bounded like that?
yes
you could :exclude org.clojure/clojure down that path
although based on where the canonicalization happens, that may not help
On https://clojure.org/reference/deps_and_cli, I don’t see any definition for the contents of the :exclusion
key
that may be underdocumented :)
:exclusions [org.clojure/clojure]
in the coordinate
it looks like lazymap 3.1.1 dropped the version range
I don't think exclusions will help you here
at the point where expansion goes to resolve the deps, it's resolving all of them, the exclusions and stuff are handled at a higher level
Putting lazymap 3.1.1 as an explicit dependency fixed it for me
yeah, that should work
lazymap isn’t a dep of my project, it’s a dep of a dep. Putting lazymap in :override-deps
doesn’t seem to do anything. Is it supposed to?
@arohner :override-deps
only works inside an alias
thanks