tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
onetom 2020-10-26T08:12:01.085800Z

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?

onetom 2020-10-26T08:16:18.087600Z

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?

onetom 2020-10-26T08:40:29.089500Z

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"]}}

dominicm 2020-10-26T08:46:58.089600Z

@onetom needs a -M before the -m, so clojure -A:ion-dev -Sdeps … -M -m nrepl.cmdline …

👍 1
practicalli-john 2020-10-26T10:29:06.096Z

@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

onetom 2020-10-26T12:02:13.096200Z

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.

onetom 2020-10-26T12:38:35.096400Z

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.

practicalli-john 2020-10-26T12:55:46.096600Z

: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.

onetom 2020-10-26T13:07:12.097100Z

to start a development repl (with cursive or cider)

onetom 2020-10-26T13:08:24.097300Z

but i want to retain the option of running datomic.ion.dev/-main, since that's the official way to deploy datomic cloud projects.

onetom 2020-10-26T13:09:56.097500Z

when i have a repl running already (started with repl related :main-opts), im just using datomic.ion.dev/{push,deploy,deploy-status} directly

alexmiller 2020-10-26T13:33:33.098600Z

There is no option to use the extra-deps but not the main-opts from an alias

alexmiller 2020-10-26T13:33:53.099400Z

You should separate those into two separate aliases if you need that

👍 1
arohner 2020-10-26T14:09:55.100500Z

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?

arohner 2020-10-26T14:11:41.100900Z

it’s not -Strace or -Stree, because those only tell me the resolved version

alexmiller 2020-10-26T14:16:12.101900Z

if you do tree, it's probably whatever is above that dep in the tree ?

alexmiller 2020-10-26T14:17:32.102500Z

I don't think I have any other magic command to tell you more unfortunately

arohner 2020-10-26T14:20:47.102700Z

that helps some, thanks

arohner 2020-10-26T14:21:37.103500Z

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 grepping

alexmiller 2020-10-26T14:22:18.104Z

alternately, use -Sdeps '{:mvn/local-repo "tmp"}'

alexmiller 2020-10-26T14:22:30.104300Z

build up a new tmp repository instead

👍 1
arohner 2020-10-26T15:58:44.105300Z

found it. de.kotka/lazymap specifies:

<dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure</artifactId>
      <version>[1.2,1.6)</version>
      <scope>compile</scope>
    </dependency>

arohner 2020-10-26T15:59:04.105700Z

should that always trigger a snapshot check?

alexmiller 2020-10-26T16:04:15.106100Z

all version ranges will trigger a resolution to the "newest" stable version

arohner 2020-10-26T16:05:07.106600Z

even when bounded like that?

alexmiller 2020-10-26T16:05:18.106800Z

yes

alexmiller 2020-10-26T16:06:01.107100Z

you could :exclude org.clojure/clojure down that path

👍 1
alexmiller 2020-10-26T16:06:27.107800Z

although based on where the canonicalization happens, that may not help

arohner 2020-10-26T16:09:10.108400Z

On https://clojure.org/reference/deps_and_cli, I don’t see any definition for the contents of the :exclusion key

alexmiller 2020-10-26T16:11:26.108600Z

that may be underdocumented :)

alexmiller 2020-10-26T16:11:35.108800Z

:exclusions [org.clojure/clojure]

alexmiller 2020-10-26T16:11:39.109Z

in the coordinate

alexmiller 2020-10-26T16:11:52.109400Z

it looks like lazymap 3.1.1 dropped the version range

alexmiller 2020-10-26T16:14:32.110100Z

I don't think exclusions will help you here

alexmiller 2020-10-26T16:15:12.111100Z

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

arohner 2020-10-26T16:15:27.111300Z

Putting lazymap 3.1.1 as an explicit dependency fixed it for me

alexmiller 2020-10-26T16:15:34.111600Z

yeah, that should work

arohner 2020-10-26T16:15:55.112100Z

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?

seancorfield 2020-10-26T16:39:28.113Z

@arohner :override-deps only works inside an alias

arohner 2020-10-26T17:02:54.113300Z

thanks