tools-build 2022-01-22

Hi all. Is there a clever way of handling deps.edn git coordinates in tools.build, or is it better to forego git coordinates when building library jars designed to be consumed by the java ecosystem and deploy via maven instead?

In essence, I’m thinking to build a ‘slightly-fat’ jar containing all dependent git coordinate repos but leaving maven dependencies in the pom to be resolved when the library is used.

Alex Miller (Clojure team) 2022-01-22T14:45:33.007900Z

you should never publish an artifact that includes another lib's source

Alex Miller (Clojure team) 2022-01-22T14:47:33.008100Z

because you have then hidden the version of that git dep inside your own and any external consumer may make decisions about the same dep without knowing about your choice - you are likely to effectively end up with two versions on the classpath in arbitrary order

Alex Miller (Clojure team) 2022-01-22T14:49:47.010600Z

but if you wanted to make such a thing but not publish it, you could make the basis, find the deps that are git deps from the basis, copy their source, remove those deps from the basis, then make a jar

Thank you. That is good advice. The context is that I'm quite happy with git coordinates in my clojure based world, but wanted to create a single Java-consumable artefact for a single purpose. I had come to the same conclusion after posting the question, and have removed all my git based coordinates and switched to only using maven based dependencies. That means it is easier to reason about and clojars makes it easy to just use maven. Thank you!

Alex Miller (Clojure team) 2022-01-22T14:51:49.012700Z

👍

As it is, tools.build has made it trivial to handle the housekeeping here so it's all looking good :)

Just changed clojure-lsp build from depstar to tools.build, just giving the feedback that was a really smooth migration, congrats for the awesome lib :)

👍 4
👍🏻 1