tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
misha 2020-11-21T11:55:24.007900Z

howdy! https://akovantsev.github.io/corpus/clojure-slack/tools-deps this channel's log as a single page (as preserved by https://clojurians-log.clojureverse.org/tools-deps) double-click on words to filter (cmd+f to highlight as per your browser), click on dates to expand filtered-out.

😀 1
borkdude 2020-11-21T12:57:23.008300Z

nice work. fwiw, it's also here: https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/topic/tools-deps

borkdude 2020-11-21T13:58:49.009400Z

We are using CLJ_CONFIG to set dependency versions properly from a "one source of truth" deps.edn file that is located in ../base. It works great. Our only problem is generating the pom file:

$ export CLJ_CONFIG=../base
clojure -A:base -X:deps mvn-pom :lib dre.annotator/annotator

Error generating pom manifest: Bad coordinate for library selmer/selmer, expected map: nil

borkdude 2020-11-21T13:59:43.009800Z

should we be using -X:base:deps ? this also doesn't work

borkdude 2020-11-21T14:33:08.012500Z

We're using the :default-deps feature

borkdude 2020-11-21T14:34:54.013100Z

Repro:

{:aliases {:versions {:default-deps {clj-kondo/clj-kondo {:mvn/version "2020.10.10"}}}}
 :deps {clj-kondo/clj-kondo nil}}
clojure -A:versions -Spath
works, but:
$ clojure -A:versions -X:deps mvn-pom
Error generating pom manifest: Bad coordinate for library clj-kondo/clj-kondo, expected map: nil

alexmiller 2020-11-22T17:46:32.024900Z

Note that -X:deps mvn-pom is not affected by changes in the classpath used to run it (so using the :versions alias with it won't affect the pom that is generated). This differs from -Spom which does work from the classpath you're choosing via clj. We are still debating the best way to supply a set of classpath-modifying options to mvn-pom (and other programs like tree).

alexmiller 2020-11-22T17:49:40.025100Z

I wasn't able to repro the error you show above with that or with variants. The code you point to should only be happening if a coord can't be resolved so that's too probably too late to be fixing this error, but I'd like to have a good repro first

alexmiller 2020-11-22T17:51:38.025300Z

also btw, mvn-pom does not take a :lib argument, I'm curious how you got the idea it did

borkdude 2020-11-22T18:33:50.025500Z

@alexmiller Tried this again.

borkdude@MBP2019 /tmp $ clojure -A:versions -X:deps mvn-pom
Error generating pom manifest: Bad coordinate for library clj-kondo/clj-kondo, expected map: nil
borkdude@MBP2019 /tmp $ clojure -Sdescribe
{:version "1.10.1.727"
 :config-files ["/usr/local/Cellar/clojure/1.10.1.727/deps.edn" "/Users/borkdude/.clojure/deps.edn" "deps.edn" ]
 :config-user "/Users/borkdude/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/Cellar/clojure/1.10.1.727"
 :config-dir "/Users/borkdude/.clojure"
 :cache-dir ".cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}
borkdude@MBP2019 /tmp $ cat deps.edn
{:aliases {:versions {:default-deps {clj-kondo/clj-kondo {:mvn/version "2020.10.10"}}}}
 :deps {clj-kondo/clj-kondo nil}}

borkdude 2020-11-22T18:34:08.025700Z

I don't know where the :lib argument came from. This was written by a colleague who went with vacation and this blocked our deploy.

borkdude 2020-11-22T18:35:01.025900Z

fwiw @seancorfield also has said he has the exact same problem at his job

borkdude 2020-11-22T19:08:14.026100Z

Same with -Srepro:

$ clojure -Srepro -A:versions -X:deps mvn-pom
Error generating pom manifest: Bad coordinate for library clj-kondo/clj-kondo, expected map: nil

alexmiller 2020-11-22T22:24:30.026300Z

thx, that repros for me

alexmiller 2020-11-22T22:53:32.026600Z

so this is exactly what I said above - the :versions alias affects the classpath of the mvn-pom program, but is not used when computing the pom deps (only the project deps.edn is used for that), and yes that's the same issue Sean has. as he said, clj -Spom works differently and that's the recommended path right now.

borkdude 2020-11-22T22:59:41.026800Z

alright, thanks

borkdude 2020-11-21T14:55:50.013500Z

my team lead is now threatening with migrating everything to mvn ;)

borkdude 2020-11-21T14:58:52.014100Z

Probably this is too strict: https://github.com/clojure/tools.deps.alpha/blob/9b3744fc9ab3b64d1e39765afc6e478c7c77cea4/src/main/clojure/clojure/tools/deps/alpha/extensions.clj#L66-L72 The map? check should be extended to allowing nil as well

seancorfield 2020-11-21T18:16:01.016600Z

@borkdude use -Spom instead

seancorfield 2020-11-21T18:16:22.017300Z

We have the exact same problem at work

seancorfield 2020-11-21T18:18:37.019400Z

(also we use {} instead of nil for overridden deps - and then :override-deps

borkdude 2020-11-21T18:40:20.020100Z

lol, I made this hack:

clojure -M:base:deps -e "(require '[clojure.tools.cli.api :as api]) (require '[clojure.tools.deps.alpha.extensions :as ext]) (alter-var-root #'ext/throw-bad-coord (constantly (fn [x y] [x y]))) (alter-var-root #'ext/throw-bad-manifest (constantly (fn [x y z] z))) (api/mvn-pom {:lib 'dre.annotator/annotator})"
but it didn't work. I'll try -Spom .

borkdude 2020-11-21T18:41:40.020300Z

@seancorfield I'm seeing:

Skipping paths: resources
Skipping coordinate: {:local/root ../genseng, :deps/manifest :deps, :deps/root ../genseng, :parents #{[]}, :paths [/Users/borkdude/dre/DocSearch/genseng/src]}

borkdude 2020-11-21T18:41:56.020700Z

we have a couple of local/root deps which it seems it doesn't pick up?

borkdude 2020-11-21T18:42:38.021100Z

Not sure if this is bad. We use the pom.xml for the uberjar with depstar:

clojure -A:base:jvm -M:depstar -m hf.depstar.uberjar target/annotator-standalone.jar -C -m dre.standalone

seancorfield 2020-11-21T19:40:58.022Z

The pom.xml isn't terribly important to depstar -- it gets artifact, group, and version from it. That's all.

seancorfield 2020-11-21T19:43:04.023400Z

We generated a pom.xml for each subproject that we build uberjars for but the dependencies aren't important. Then we do the CLJ_CONFIG=../versions clojure -M:defaults:depstar ...etc... much like you @borkdude

borkdude 2020-11-21T19:44:17.023600Z

yep, same. thanks!

borkdude 2020-11-21T19:44:41.023900Z

In the olden boot days I wrote my own solution for this: https://github.com/borkdude/boot-bundle