Fork me on GitHub
#tools-build
<
2022-01-22
>
Mark Wardle08:01:30

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?

Mark Wardle08:01:50

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)14:01:33

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

Alex Miller (Clojure team)14:01:33

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)14:01:47

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

Mark Wardle14:01:06

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!

Mark Wardle14:01:21

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

ericdallo22:01:59

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 :)

1
👍 4