Fork me on GitHub
#tools-deps
<
2019-12-03
>
didibus00:12:07

I see, so local deps always wins, and in the case of conflicting local deps it would error.

didibus00:12:28

But maven and git can both use the commit sha to find out which one is newest

didibus00:12:05

I'm not seeing anything scm related or git related in the manifest spec: https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#Manifest_Specification there's a version-number field, but that assumes digits

seancorfield00:12:42

@didibus it would be in pom.xml not the manifest

seancorfield00:12:39

for example

<scm>
    <url></url>
    <connection>scm:git:</connection>
    <developerConnection>scm:git:@github.com/seancorfield/next-jdbc.git</developerConnection>
    <tag>05a6d8a47fcea7dc2928e5e2c176310fb7205e0c</tag>
  </scm>
(from next.jdbc's pom.xml that is used for deployment to Clojars)

didibus00:12:55

I thought it was common to put tag to HEAD ?

didibus00:12:25

Also, what does maven do with that? Is the pom.xml uploded to Clojars as well?

seancorfield00:12:36

Yes, the pom.xml is what tells Clojars how to link to the commit that is tied to the release.

seancorfield00:12:27

It can either be a specific tag or a SHA.

seancorfield00:12:52

(I happen to use SHAs, just because I have a deploy script that does that automatically)

didibus00:12:05

Sounds like days worth of fun debugging conflicts to be honest 😛 But hopefully it mostly works itself out in practice

seancorfield00:12:27

Why would you think that?

seancorfield00:12:53

Clojars shows which commit is referenced in pom.xml

didibus00:12:22

Well, maybe I'm wrong. But I can see the tag not mapping to the correct version, and issues incurring. Though I guess there's nothing to do about that

seancorfield00:12:58

Sure, you can "lie" in pom.xml if you don't have some automated release process...

didibus00:12:18

And what does happen if you set HEAD as the tag?

didibus00:12:34

Is that automatically replaced by the HEAD sha at time of deploy?

seancorfield00:12:54

Deployment is independent of Git (so, no).

seancorfield00:12:13

(at least, that is my understanding)

seancorfield00:12:03

Certainly, you can mess up the <scm> part of pom.xml -- when I first started publishing to Clojars via clojure-generated POM files, I messed up several times. Hence, automation 🙂

seancorfield00:12:45

cljdoc also relies on pom.xml being accurate so it can pull the correct version of your repo from GitHub to generate docs that match the release artifact...

didibus00:12:12

I mean, the example on Maven shows HEAD as tag: https://maven.apache.org/pom.html#SCM

didibus00:12:59

It says: tag: Specifies the tag that this project lives under. HEAD (meaning, the SCM root) should be the default.

didibus00:12:45

Anyways, it does seem more standard then I thought. It should be a pretty nice way to handle cross resolver conflicts.

didibus00:12:13

I guess a local deps could also use the pom.xml found in the directory for conflict resolution ?

Alex Miller (Clojure team)00:12:11

it could if there is one

Alex Miller (Clojure team)00:12:28

although I think the chances that value is meaningful+correct in a local dep is low

Alex Miller (Clojure team)00:12:07

vs the rev in an artifact, which is almost always updated during deployment

Alex Miller (Clojure team)00:12:50

open question what to do for a local dep that also happens to be a git repo

Alex Miller (Clojure team)00:12:11

I would need to think about that for a while and make some tables

Alex Miller (Clojure team)00:12:18

there are requests for git deps on the file system too (which we don't support right now) so that intersects

didibus00:12:23

The world of dependency management is hard. I've lost so many hours of my life managing dependencies 😛 At least Clojure libs rarely break anything, so which version ends up chosen doesn't matter as much 😛

Alex Miller (Clojure team)00:12:09

yeah, I've been doing this stuff for 22 years in the Java universe. those early years pre-Maven were kinda weird.

didibus00:12:05

I do love how tools.deps resolves conflicts by picking latest though. That's a huge improvement for me with regards to Maven.

seancorfield00:12:07

Somehow I managed to completely skip Maven until I got to Clojure... 👀

Alex Miller (Clojure team)00:12:26

managing your deps manually is a very instructive process (not very efficient in the long run, but doing it a little really gives you an appreciation)

Alex Miller (Clojure team)00:12:41

I used (and wrote) a lot of bespoke tools pre-Maven

didibus00:12:33

I never lived in the pre-maven world, for the better I guess

niclasnilsson10:12:59

adding libs on the fly in the repl? If I’m not mistaking the commit pointed to in http://insideclojure.org/2018/05/04/add-lib/ is gone, and github says there is no add-lib function or a repl ns in the repo. Any ideas on how people do this nowadays?

dharrigan10:12:36

and in particular line 139

dharrigan10:12:41

you'll see how it is used 🙂

niclasnilsson10:12:08

@dharrigan, thanks (I wonder why github didn’t find add-lib in that very repo though?) . But, I don’t get it work though. Installing the deps worked, but I get a NullPointerException when trying to add a lib. Anything you recognize?

user=> (require '[clojure.tools.deps.alpha.repl :refer [add-lib]])
nil
user=> (add-lib 'honeysql {:mvn/version "0.9.8"})
Execution error (NullPointerException) at clojure.tools.deps.alpha.util.maven/make-session (maven.clj:173).
null

Alex Miller (Clojure team)10:12:28

add-lib exists only on a branch, has never been integrated on the main line

niclasnilsson10:12:48

@alexmiller, yep, understood. I used the sha in Sean’s deps.edn right now though

Alex Miller (Clojure team)10:12:24

That sha is on the add-lib branch which typically lags master

niclasnilsson10:12:20

(when I get the NPE)

Alex Miller (Clojure team)10:12:22

You should never see that error but I have seen people report this. I’ve never been able to repro

niclasnilsson10:12:03

Interesting. Any special investigation I can undertake on my env?

Alex Miller (Clojure team)10:12:15

It should be impossible by my understanding of the code so clearly some assumption I have is wrong

niclasnilsson10:12:47

Even more interesting 🙂

dharrigan10:12:02

@niclasnilsson seems to work for me!

dharrigan10:12:13

user=> (require '[clojure.tools.deps.alpha.repl :refer [add-lib]])
nil
user=> (add-lib 'honeysql {:mvn/version "0.9.8"})
true

👍 4
dharrigan10:12:42

Try deleting your .cpcache?

niclasnilsson10:12:01

Good idea. Will try. (But I’ll save it some place else)

Alex Miller (Clojure team)10:12:04

Should t be using cpcache

Alex Miller (Clojure team)10:12:56

That’s for caching classpaths but you’re not making those here, you’re dynamically updating runtime

Alex Miller (Clojure team)10:12:28

What repl env are you in?

Alex Miller (Clojure team)10:12:56

Not all repls have the right classloader setup for this to work

niclasnilsson10:12:48

Clearing .cpcaches didn’t work

Alex Miller (Clojure team)10:12:20

I’d be shocked if it did :)

niclasnilsson10:12:33

repl: Vanilla clj

niclasnilsson10:12:00

(no socket, no nrepl)

Alex Miller (Clojure team)10:12:18

Well, don’t know then

niclasnilsson10:12:18

The docs say “Note that for successful use, you must be in a REPL environment where a valid parent DynamicClassLoader can be found in which to add the new lib urls.“, but I suppose that’s the case when I just fire up clj?

niclasnilsson10:12:43

Hmm… It works if I have a deps.edn only contaning

{:deps
 {org.clojure/tools.deps.alpha {:git/url ""
                                :sha "148cab8f154711f8495bd632ebdc53a14dff7f09"}}}

niclasnilsson10:12:41

But not in my project, so likely something in there messes it up. I’ll reduce my deps.edn and see if I can find it.

dharrigan10:12:11

you can do clojure -Stree to get a list

Alex Miller (Clojure team)10:12:24

If you have something that doesn’t work now, I’d take that

dominicm10:12:52

I had a repro for this involving dependency conflicts

dominicm10:12:53

https://github.com/juxt/pack.alpha/issues/64 oz transitively brings in a different maven package.

dominicm11:12:16

The session lookup fails because its the wrong class

dominicm11:12:31

It's one from a different dependency

dominicm11:12:53

It's not specific to the add lib branch, it's just the only time users interact with maven outside of the clj internal classpath

niclasnilsson11:12:09

{:deps        
 {metasoarous/oz                {:mvn/version "1.6.0-alpha5"}
  org.clojure/tools.deps.alpha  {:git/url ""
                                 :sha "148cab8f154711f8495bd632ebdc53a14dff7f09"}}}
and
(require '[clojure.tools.deps.alpha.repl :refer [add-lib]])
(add-lib 'honeysql       {:mvn/version "0.9.8"})
causes the NullPointerException. Unfortunately oz pulls in half the world…

niclasnilsson11:12:45

Ah, I see @dominicm already pointed out oz and the cause.

dominicm11:12:01

@alexmiller let me know if there's anything I can do to help with explaining or documenting this. I spent a lot of effort debugging it, and I hate for that to be a waste.

Alex Miller (Clojure team)11:12:26

Oh interesting, I had not seen all that debugging before

Alex Miller (Clojure team)11:12:43

Do you have jira access?

dominicm11:12:47

You helped me with it 😜

Alex Miller (Clojure team)11:12:30

If you could file a tdeps ticket, that would be great for tracking

Alex Miller (Clojure team)11:12:55

I don’t think there is one

Alex Miller (Clojure team)11:12:44

Certainly oz should not be publishing an uberjar, that’s evil

Alex Miller (Clojure team)11:12:11

I’d like to be able to fail better in tdeps though

dominicm11:12:13

oz shouldn't be doing an uberjar, but this is unrelated to that.

dominicm11:12:12

the problem is that maven-aether-resolver and maven-resolver-provider conflict. I think oz gets the former through pomegranate, but icr right now, will double check before I file the jira.

dominicm11:12:44

@alexmiller I think I did mention the resolution in this channel, is there a better place to mention that kind of thing to make sure you don't miss it next time?

dominicm11:12:55

As a total aside, on my wishlist if for maven to support "provides", as in "juxt/tools.namespace" provides "org.clojure/tools.namespace", so there should only be one of them in the classpath (same for things where a -complete artifact is provided such as antlr. There's N artifacts and a "bundled" artifact too.)

markbastian21:12:27

I'm having a deps issue with (drumroll, please), jackson. I have com.fasterxml.jackson.core/jackson-core {:mvn/version "2.10.1"} in my :deps map, but when I do an ion-dev push it reports a conflict of com.fasterxml.jackson.core/jackson-core #:mvn{:version "2.9.8"}. This manifests itself when my ns gets loaded with the error "com.fasterxml.jackson.core.exc.InputCoercionException," which is a 2.10 addition. I tried adding the library to :override-deps instead, without success. Any tips on what I am doing wrong (besides needing jackson)?

Alex Miller (Clojure team)22:12:06

can you share your ion-dev alias?

Alex Miller (Clojure team)22:12:20

specifically, is it using :extra-deps or :deps?

Alex Miller (Clojure team)22:12:55

and if it's using :extra-deps, can you switch it to :deps? (need newish version of clj for that to work)

markbastian22:12:56

Sure, latest attempt:

{:aliases
                {:ion-dev
                 {:deps      {com.datomic/ion-dev {:mvn/version "0.9.247"}}
                  :main-opts ["-m" "datomic.ion.dev"]}}

 :paths         ["src" "resources"]

 :deps          {com.cognitect/anomalies    {:mvn/version "0.1.12"}
                 com.datomic/client-cloud   {:mvn/version "0.8.78"}
                 com.datomic/ion            {:mvn/version "0.9.35"}
                 org.clojure/clojure        {:mvn/version "1.10.1"}
                 org.clojure/data.json      {:mvn/version "0.2.6"}
                 metosin/ring-http-response {:mvn/version "0.9.1"}
                 ring/ring-defaults         {:mvn/version "0.3.2"}
                 ring/ring-json             {:mvn/version "0.5.0"}
                 metosin/jsonista           {:mvn/version "0.2.5"}
                 metosin/reitit             {:mvn/version "0.3.10"}
                 javax.xml.bind/jaxb-api    {:mvn/version "2.4.0-b180830.0359"}
                 }

 :override-deps {com.fasterxml.jackson.core/jackson-core     {:mvn/version "2.10.1"}
                 com.fasterxml.jackson.core/jackson-databind {:mvn/version "2.10.1"}}

 :mvn/repos     {"datomic-cloud" {:url ""}}}

Alex Miller (Clojure team)22:12:29

so the error is not during push, it's when your code is run in the ion

Alex Miller (Clojure team)22:12:39

that :override-deps in your deps.edn isn't doing anything - that only works in an alias

Alex Miller (Clojure team)22:12:09

but you can just add those to your main :deps

markbastian22:12:15

Right, I get a warning when I push stating that I have the dependency conflict on 2.9.8 and the error is at runtime. I am assuming this is because the ion is using the older version without the InputCoercionException class.

markbastian22:12:45

Yeah, that override-deps was just my attempt to get the override to work. It was in deps before.

Alex Miller (Clojure team)22:12:57

{:aliases
                {:ion-dev
                 {:deps      {com.datomic/ion-dev {:mvn/version "0.9.247"}}
                  :main-opts ["-m" "datomic.ion.dev"]}}
 :paths         ["src" "resources"]
 :deps          {com.cognitect/anomalies    {:mvn/version "0.1.12"}
                 com.datomic/client-cloud   {:mvn/version "0.8.78"}
                 com.datomic/ion            {:mvn/version "0.9.35"}
                 org.clojure/clojure        {:mvn/version "1.10.1"}
                 org.clojure/data.json      {:mvn/version "0.2.6"}
                 metosin/ring-http-response {:mvn/version "0.9.1"}
                 ring/ring-defaults         {:mvn/version "0.3.2"}
                 ring/ring-json             {:mvn/version "0.5.0"}
                 metosin/jsonista           {:mvn/version "0.2.5"}
                 metosin/reitit             {:mvn/version "0.3.10"}
                 javax.xml.bind/jaxb-api    {:mvn/version "2.4.0-b180830.0359"}
                 com.fasterxml.jackson.core/jackson-core     {:mvn/version "2.10.1"}
                 com.fasterxml.jackson.core/jackson-databind {:mvn/version "2.10.1"}}

:mvn/repos     {"datomic-cloud" {:url ""}}}

Alex Miller (Clojure team)22:12:18

ok, well then I would send you to #datomic - this is not the first time they've seen something like this, but I don't know the recommended path forward. I think you're right on with what the problem is.

markbastian22:12:23

I'll give that shot and report the output. I think I had done that before. BTW, the jaxb addition was because of this warning when I do the ion push: [s3-transfer-manager-worker-6] WARN com.amazonaws.util.Base64 - JAXB is unavailable. Will fallback to SDK implementation which may be less performant

markbastian22:12:53

Cool, let me give this a shot and I'll let you know what happened then bounce over to datomic.

Alex Miller (Clojure team)22:12:58

yeah, that's likely due to being on java 9+

Alex Miller (Clojure team)22:12:05

it's included in java 8

Alex Miller (Clojure team)22:12:24

but they've been shedding all those j2ee libs from the jdk

markbastian22:12:25

Is the datomic runtime 8 or 9?

Alex Miller (Clojure team)22:12:42

I mean, it must be 8 or 11

Alex Miller (Clojure team)22:12:55

9 and 10 are dead and I can't imagine they're using those, so I'd guess 8

markbastian22:12:43

Full output:

Downloading: com/datomic/java-io/0.1.11/java-io-0.1.11.pom from 
(cognitect.s3-libs.s3/upload "datomic-code-d70d7189-fa46-4cd5-8004-423b714e486b" [{:local-zip ".datomic-ions/datomic/apps/ion-repl/stable/ff0ed784b940e81fa02f8a0808a3fc06719bfc1b.zip", :s3-zip "datomic/apps/ion-repl/stable/ff0ed784b940e81fa02f8a0808a3fc06719bfc1b.zip"}] {:op :push})
[s3-transfer-manager-worker-6] WARN com.amazonaws.util.Base64 - JAXB is unavailable. Will fallback to SDK implementation which may be less performant
{:rev "ff0ed784b940e81fa02f8a0808a3fc06719bfc1b",
 :deploy-groups (ion-repl-Compute-1TPY2S14U7NT9),
 :dependency-conflicts
 {:deps
  {com.cognitect/transit-java #:mvn{:version "0.8.311"},
   org.clojure/clojure #:mvn{:version "1.10.0"},
   commons-codec/commons-codec #:mvn{:version "1.12"},
   com.datomic/client-api #:mvn{:version "0.8.37"},
   com.fasterxml.jackson.core/jackson-core #:mvn{:version "2.9.8"},
   com.datomic/client #:mvn{:version "0.8.86"},
   org.msgpack/msgpack #:mvn{:version "0.6.10"},
   com.datomic/client-impl-shared #:mvn{:version "0.8.69"},
   com.cognitect/transit-clj #:mvn{:version "0.8.285"},
   com.cognitect/s3-creds #:mvn{:version "0.1.23"},
   com.datomic/client-cloud #:mvn{:version "0.8.80"},
   com.amazonaws/aws-java-sdk-kms #:mvn{:version "1.11.479"},
   com.amazonaws/aws-java-sdk-s3 #:mvn{:version "1.11.479"}},
  :doc
  "The :push operation overrode these dependencies to match versions already running in Datomic Cloud. To test locally, add these explicit deps to your deps.edn."},
 :deploy-command
 "clojure -A:ion-dev '{:op :deploy, :group ion-repl-Compute-1TPY2S14U7NT9, :rev \"ff0ed784b940e81fa02f8a0808a3fc06719bfc1b\"}'",
 :doc
 "To deploy to ion-repl-Compute-1TPY2S14U7NT9, issue the :deploy-command"}

markbastian22:12:14

I'll try the deploy, but I think it's going to be broken. I'll try #datomic. Thanks!

Alex Miller (Clojure team)22:12:34

yeah, I mean it's telling you that in the result there

markbastian22:12:51

Right. "We're using this library that hasn't got a class you're going to need."

Alexis Vincent22:12:48

@alexmiller Hi there Alex, thanks for building/maintaining deps. And all the rest you do for the clj community. Much appreciation! Had a couple of questions. 1. I’m trying to use tools.deps as a lib. But have an issue using resolve-deps . One of the deps.edn files uses a package from a mvn repo, where the repo is declared in the deps.edn file, and where the cli picks it ub correctly. But it blows up for me when using the lib with:

Could not find artifact io.confluent:kafka-schema-registry-client:jar:5.3.0
   in central ()

Alexis Vincent22:12:54

im calling it using

(-> {:deps {'root/root {:local/root "<path to root project>"}}
       :mvn/repos mvn/standard-repos}
      (deps/resolve-deps nil
                         {:trace true})))

Alexis Vincent22:12:18

the required file includes the mvn repo as

:mvn/repos
 {"confluent" {:url ""}}

Alexis Vincent22:12:05

2. I have a case where that file adds a jar to its paths. But when using juxt’s pack, it thinks the jar lives at one of the transative local/root dependencies dirs. I dont know if this is a pack problem or something with tools.deps. But im guessing deps.

dominicm08:12:48

I don't fully follow this, sorry. Can you expand?

Alexis Vincent23:12:14

How do I best give you info to help fix the bug? I’ve managed to work around it for now using depstar