Fork me on GitHub
#tools-deps
<
2023-04-16
>
seancorfield23:04:00

Not sure where best to post this but it's tools.deps-adjacent... In Clojure 1.12.0 Alpha 2, https://clojure.github.io/clojure/branch-master/clojure.tools.deps.interop-api.html#clojure.tools.deps.interop/invoke-tool provides a way to invoke tools in a subprocess. It lets you specify either a tool name (as a string "mytool", for -Tmytool) or as a single alias (as a keyword :mytoolalias, for -T:mytoolalias) -- but I have a situation where I have a tool that is essentially spread across two aliases: it has a "swappable" portion that needs to be provided by one of two other aliases. Specifically, it's a tool that expects an HTTP client to be provided in order to run, and using the CLI, you can do that as follows:

> clojure -T:the-tool:http-client-a do-some/stuff
# or:
> clojure -T:the-tool:http-client-b do-some/stuff
It would be really nice to be able to do this programmatically via the new invoke-tool function (in build.clj in my case). Now, invoke-tool doesn't currently check the type of either the :tool-alias or the :tool-name parameter, nor does it currently do anything different based on which one is supplied (except that :tool-alias is preferred: (str "-T" (or tool-alias tool-name))), so I could pass :tool-alias ":dev:+default" in this case and it would "just work" but that seems like a hack... ...would a :tool-aliases option be a useful addition here (a vector of keywords that was str/join'd to make the string passed to -T)?

Hugh Powell23:04:20

Hi folks, I've been looking at using the http://javamoney.github.io/ APIs. All of the tutorials/examples that I can find (e.g. https://www.baeldung.com/java-money-and-currency) require the use of the org.javamoney/moneta dependency. As far as I can tell this is just a reference to a pom.xml file, rather than a jar. When I add org.javamoney/moneta {:mvn/version "1.4.2"} to deps.edn and run clojure -Sforce I get the following error > Error building classpath. Could not find artifact org.javamoney:moneta:jar:1.4.2 in central (https://repo1.maven.org/maven2/) Is there a way to use this dependency in deps.edn?

👋 2
seancorfield23:04:39

You will need to specify the component subprojects from that pom.xml explicitly for deps.edn

Hugh Powell23:04:59

Aha, cool. Thanks 🙇 . So there's no way to reference those non-jar dependencies in deps.edn?

seancorfield23:04:59

Not currently, no. You'll need the following, explcitly:

org.javamoney.moneta/moneta-core {:mvn/version "1.4.2"}
  org.javamoney.moneta/moneta-convert {:mvn/version "1.4.2"}
  org.javamoney.moneta/moneta-convert-imf {:mvn/version "1.4.2"}
  org.javamoney.moneta/moneta-convert-ecb {:mvn/version "1.4.2"}

Hugh Powell23:04:18

Awesome, thanks 👍