I can ask it but perhaps it's easy enough
What I am doing wrong here?
user> (tools.deps/resolve-deps {:deps '{com.google.cloud.opentelemetry/exporter-trace {:mvn/version "0.25.2"}}}
{})
Execution error (ArtifactNotFoundException) at org.eclipse.aether.internal.impl.DefaultArtifactResolver/resolve (DefaultArtifactResolver.java:496).
Could not find artifact org.apache:apache:pom:21
When depending on com.google.cloud.opentelemetry/exporter-trace via deps.edn, it works fine and it gets added to the classpath.
But with programmatic usage, it chokes on https://mvnrepository.com/artifact/org.apache/apache/21 , which to be fair looks like an odd dependency:
[org.apache/apache "21" :extension "pom"]
I have tried different variations of programmatic usage, no luckThe last argument of resolve-deps is the procurer config - you’re passing an empty map which means you are defining no maven repos, so nothing will be found
You can instead pass the var defining the standard repos https://github.com/clojure/tools.deps/blob/52a1e172457fe934bbcfb8e5a216ecd1f37590fa/src/main/clojure/clojure/tools/deps/util/maven.clj#L61
Or rather, those need to be in the first arg (see https://github.com/clojure/tools.deps/blob/52a1e172457fe934bbcfb8e5a216ecd1f37590fa/src/main/clojure/clojure/tools/deps.clj#L955 example)
Thanks, Alex! specifying :mvn/repos worked.
Perhaps the behavior when they're nil/empty could be improved? In this thread I showed one way in which errors won't point in that direction. In this other question I posted another https://ask.clojure.org/index.php/13201/clojure-tools-deps-calc-basis-unable-resolve-version-range
It would probably make sense to fail-fast when performing maven ops with no repos backing them? Or at least, include that info prominently in the ex-msg / ex-data.
It's important to separate the CLI (which provides a lot of assumptions and defaults) from the lib. The lib is a more general tool and you have to provide more context. You don't need to pass any maven repos if you're doing git-only stuff for example, so it's not an error to not have repos. If you get unable to resolve, that's what it means - the lib you asked for can't be found in the repos given. There's no way to know if that's because you didn't provide the right repos or if the lib doesn't exist.
even if you don't have repos you might be able to serve libs already in the local cache
Yes, I understand those principles, and in particular that there isn't a hard-and-fast way to determine the cause of a failure.
However by including the :mvn/repos in the ex-data, users can make a more educated guess of what's going on.
well, I think you're probably wrong because no one actively looks at the ex-data
IDK, we Clojurists are a diverse and generally smart bunch :)
well that is true
Does the clojure.tools.deps ns have a function that given a "-M:what:ever" , will return (or at least include somewhere) the main program that will be executed? i.e. the name of the underlying java class
https://clojure.github.io/tools.deps/#clojure.tools.deps/create-basis is really the primary entry point now and it takes :aliases vector. all merged and resolved alias options will be in the :argmap of the return map
so (-> (create-basis {:aliases [:what :ever]}) :argmap :main-opts) should be something like ["MainClass" ...]
Thanks! I got it working