Fork me on GitHub
#tools-deps
<
2020-06-29
>
Jakub Holý (HolyJak)08:06:08

Hello! Could somebody be so kind and explain to me why clj is trying to download a dependency from Maven Central when I told it to you our company repository (I assume M.C. is always used as a back up; but it doesn't seem it has even tried?!:

$ cat deps.edn
{:mvn/repos {"telia-aws" {:url ""}}
 :deps    {com.oracle.jdbc/ojdbc8       {:mvn/version "12.2.0.1"}}}

$ deps.exe -Sverbose
deps.clj version = 0.0.8
...

Refreshing classpath
Error building classpath. Could not find artifact com.oracle.jdbc:ojdbc8:jar:12.2.0.1 in central ()
🙏 Thank you!

3
borkdude08:06:13

I think that error message just picks a repo and doesn't list all of them

Jakub Holý (HolyJak)10:06:33

It seems you were right! The problem turned out to be that my URL was wrong, it was missing a part of the path. The -Sverbose option was quite useless for troubleshooting this... :-(

Jakub Holý (HolyJak)11:06:58

Any idea why is clj trying to download a snapshot .jar from Central (where it isn't) when I have it in the local .m2 repo? Do I need to tell it to use the local repo?? > Error building classpath. Could not find artifact no.telia:clj-common:jar:0.1.0-20200507.122109-9 in central (https://repo1.maven.org/maven2/)

ls ~/.m2/repository/no/telia/clj-common/0.1.0-SNAPSHOT/clj-common-0.1.0-20200507.122109-9.jar                                                                                                                          
/Users/me/.m2/repository/no/telia/clj-common/0.1.0-SNAPSHOT/clj-common-0.1.0-20200507.122109-9.jar
The dependency is declared as:
no.telia/clj-common {:mvn/version "0.1.0-20200507.122109-9"} ;; a particular SNAPSHOT

borkdude11:06:23

SNAPSHOT versions are refreshed from external repositories at least once a day (by default, you can configure this in .m2 settings I believe)

borkdude11:06:47

it's maven behavior

Jakub Holý (HolyJak)11:06:25

Ah, ok. And if it fails to refresh, it just crashes without using the old version?

Alex Miller (Clojure team)13:06:20

deps doesn't currently expose this setting

Jakub Holý (HolyJak)15:06:31

So it doesn't take all of settings.xml into account, only parts of it (ie auth)?

Alex Miller (Clojure team)15:06:16

it does not consider that setting, it does take more than just auth though

Alex Miller (Clojure team)15:06:52

specifically, also supports mirrors and proxies

👍 3
Jakub Holý (HolyJak)11:06:42

Hm, it seems that clj simply ignores my local .m2/repository. Now it is trying to download com.oracle.jdbc:ucp:pom:12.2.0.1 even though ~/.m2/repository/com/oracle/jdbc/ucp/12.2.0.1/ucp-12.2.0.1.jar exists...:

$ cat deps.edn
{:deps {com.oracle.jdbc/ucp {:mvn/version "12.2.0.1"}}}
$ clj
Error building classpath. Could not find artifact com.oracle.jdbc:ucp:jar:12.2.0.1 in central ()
$ ls -lh ~/.m2/repository/com/oracle/jdbc/ucp/12.2.0.1/ucp-12.2.0.1.jar
-rw-r--r--  1 holyjak  staff   1.0M Apr  2 13:55 /Users/holyjak/.m2/repository/com/oracle/jdbc/ucp/12.2.0.1/ucp-12.2.0.1.jar
Why?!

Alex Miller (Clojure team)13:06:15

did you put that jar manually in your .m2?

Alex Miller (Clojure team)13:06:30

if so, you may be missing some metadata in your local cache that's triggering a lookup

Jakub Holý (HolyJak)15:06:23

No, via mvn install-file . And it used to work...

Alex Miller (Clojure team)15:06:12

based on what I see here, I would expect it to find and use the jar in your local cache

Alex Miller (Clojure team)15:06:32

you might want to clj -Sforce to make sure you don't have a cached classpath or something

Alex Miller (Clojure team)15:06:23

I don't think that will matter since it seems to be building the classpath when it encounters the error, but just a good habit when diagnosing clj stuff