I’m having an issue using a dep from maven. The dep is https://central.sonatype.com/artifact/org.nd4j/nd4j/1.0.0-M2.1 (org.nd4j/nd4j). I can browse to it at https://repo1.maven.org/maven2/org/nd4j/nd4j/1.0.0-M2.1/ . But there are no jars in that folder, just a pom and checksums. Looking at the pom I don’t see it labelled as a bom, but I do see <modules> that makes me think it is using a feature that tools.deps doesn’t support.
> ❯ clj -Sdeps ‘{:deps {org.nd4j/nd4j {:mvn/version “1.0.0-M2.1”}}}’ -P
> Error building classpath. Could not find artifact org.nd4j:nd4j:jar:1.0.0-M2.1 in central (https://repo1.maven.org/maven2/)
Figure out which modules you need and then add them one-by-one ? This is one of them: https://repo1.maven.org/maven2/org/nd4j/nd4j-tensorflow/1.0.0-M2.1/nd4j-tensorflow-1.0.0-M2.1.pom
ok. so modules are opaque to tools.deps and i can unfurl them manuall?
Is there a way to consume this dependency with tools.deps?
pom-only or bom dependencies are not currently supported as top-level deps, this is a wip area (https://clojure.atlassian.net/browse/TDEPS-202)
how can i recognize that this is “pom-only” dependencies? Is it <modules>?
<packaging>pom</packaging>ah. thank you
modules is about maven build time, doesn't affect anything on consumption side
Is it documented anywhere that tool aliases can use :deps and :paths, and that this will replace the project deps? https://clojure.org/reference/deps_and_cli#_arg_map_keys doesn’t mention it, and I can’t find it explicitly mentioned in the reference, but there’s an example at https://clojure.org/reference/deps_and_cli#_using_tool_aliases. What is the difference between doing this and using :replace-deps?
Personally I find the :deps and :path shortcuts make learning and maintaining Clojure CLI projects more involved. deps and paths do different things depending on if they are at the top level or in an :aliases definition.
I encourage use of the explicit names to make it obvious as to what the configuration will do.
Sounds very wise to me.
No difference, they are aliases
Same with paths and replace-paths
Ok thanks.
Kind of a historical artifact at this point
Is one or the other the preferred way going forward?
I'll be interested to hear it there's a preference at this point... The official guide suggests :deps (and paths is rarely needed but I'd expect :paths to be suggested), but I don't remember the history...
Does it? The deps and cli ref mostly mentions :replace-deps, and only has :deps in examples. I can’t see anywhere there where it’s even documented that :deps is a thing you can use (although the doc is big and dense, I might have missed it).
The official tools.build guide, I meant, shows :deps.
Ah, ok
Yes, the CLI/deps guide/reference talks about :replace-deps and :replace-paths in https://clojure.org/reference/deps_and_cli#_replace_project_environment_tool and https://clojure.org/reference/deps_and_cli#_arg_map_keys but that was about how to get tool-like behavior before -T existed I think? But https://clojure.org/guides/tools_build#_setup talks about -T and :deps and :paths.
Well, the deps and cli ref definitely discusses -T, as well as installing tools and running them via aliases. I don’t think it’s a big deal, but the inconsistency makes it more confusing than it needs to be right now.
Sure, but that reference has this example:
:aliases {
:linter {:deps {cool/lint-tool {:git/tag "..." :git/sha "..."}}
:ns-default cool.lint.tool}
With :deps, not :replace-deps.I agree it could be cleaned up. I'm not sure it's "inconsistent" tho'...
Yes, I know, I linked that above. But having it appear like that in examples, when there’s no mention in the doc that that is even possible, is confusing.
It omits quite a bit of nuance (but that's nothing new for Clojure docs).
No mention of what in the doc?
That you can use :deps in aliases instead of :replace-deps. Under “Arg Map Keys” only the replace- versions are shown.
You're not joining the dots tho'... All of the tool examples use :deps and the narrative around -T says that project :deps / :paths are ignored so you only get :deps and :paths from the alias (or the tool) -- and that if :paths is omitted you get ["."]. That's all consistent.
I guess we’ll have to agree to disagree. Anyway, at least I understand what’s going on now.
The :replace-deps / :replace-paths stuff is not inconsistent with that: it says that in any context (`-M`, -X, or -T), those override the other deps/paths.
I'm not sure what we're disagreeing on -- but I'm glad you understand the docs, I think?
No, I understand what is going on after Alex clarified it for me above 🙂