tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
Jakub HolĂ˝ 2020-06-29T08:49:08.107900Z

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 "<https://my.company.net/component/artifacts>"}}
 :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 (<https://repo1.maven.org/maven2/>)
🙏 Thank you!

✅ 1
borkdude 2020-06-29T08:51:13.108400Z

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

Jakub HolĂ˝ 2020-06-29T10:45:33.110200Z

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Ă˝ 2020-06-29T11:13:58.112600Z

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

borkdude 2020-06-29T11:16:23.113300Z

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

borkdude 2020-06-29T11:16:47.113600Z

it's maven behavior

Jakub HolĂ˝ 2020-06-29T11:20:25.114200Z

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

Jakub HolĂ˝ 2020-06-29T11:21:57.115200Z

I found http://maven.apache.org/ref/3.6.2/maven-settings/settings.html#class_snapshots, I can try to set updatePolicy to never...

Jakub HolĂ˝ 2020-06-29T11:32:42.116100Z

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 (<https://repo1.maven.org/maven2/>)
$ 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?!

alexmiller 2020-06-29T13:23:15.117Z

did you put that jar manually in your .m2?

alexmiller 2020-06-29T13:24:30.118100Z

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

alexmiller 2020-06-29T13:25:20.118200Z

deps doesn't currently expose this setting

Jakub HolĂ˝ 2020-06-29T15:51:31.118500Z

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

alexmiller 2020-06-29T15:52:16.119500Z

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

Jakub HolĂ˝ 2020-06-29T15:52:23.119800Z

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

alexmiller 2020-06-29T15:52:42.120200Z

https://clojure.org/reference/deps_and_cli describes supported stuff

alexmiller 2020-06-29T15:53:52.120500Z

specifically, also supports mirrors and proxies

👍 1
alexmiller 2020-06-29T15:53:59.120700Z

and http properties

alexmiller 2020-06-29T15:56:12.121400Z

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

alexmiller 2020-06-29T15:56:32.121800Z

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

alexmiller 2020-06-29T15:57:23.122500Z

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

Jakub HolĂ˝ 2020-06-29T20:43:22.122800Z

Ok, thank you!