tools-build 2021-09-15

@alexmiller not sure if you saw my follow-up Q last night? It was pretty late for you...

Alex Miller (Clojure team) 2021-09-15T16:50:37.166600Z

sorry, I'll get back to it in a bit

OK, NP.

Alex Miller (Clojure team) 2021-09-15T20:06:04.167300Z

@seancorfield looked at it again and I think you're right, uber can just do all the things here

Alex Miller (Clojure team) 2021-09-15T20:08:51.167500Z

will update guide

Cool. And prep could be a separate example for a lib that needs to either javac or compile-clj something?

(this means it's definitely worth me adding a shortcut uber function to my build-clj library!)

Alex Miller (Clojure team) 2021-09-15T20:23:11.168800Z

yeah

Alex Miller (Clojure team) 2021-09-15T20:53:06.169500Z

tools.build v0.4.0 801a22f is now available • uber - TBUILD-2 - add support for configurable conflict handlers • uber - TBUILD-11 - detect file and dir with same name in uber • uber - TBUILD-16 - expand default exclusions • uber - add support for custom exclusions

Love the new uber function with conflict handlers. I just started to play with it and had a question. I noticed that user provider rules are merged with the default, and then the “first” handler with a matching regex is used for each conflict. Is there a way to control the priority of handler rules? For example, the "^META-INF/services/" :append handler rule is a good default but (I think) I have a specific service where :append-dedupe is more appropriate but I don’t know how to be sure that my more specific regex will be considered first.

Alex Miller (Clojure team) 2021-09-16T11:56:47.176300Z

No, so you’d need to merge a replacement that handled your special case

Gotcha, thanks

Alex Miller (Clojure team) 2021-09-15T20:53:21.169900Z

many thanks to Sean Corfield for the help on all of that

io.github.seancorfield/build-uber-log4j2-handler {:git/tag "v0.1.0" :git/sha "ab8e499"} -- a conflict handler for tools.build v0.4.0+ that handles merging of Log4j2Plugins.dat files. This was the missing gap between what tools.build's uber task and depstar's uberjar function did (so at this point I plan to sunset depstar and encourage everyone to use tools.build instead!). See https://github.com/seancorfield/build-uber-log4j2-handler for more details!

🎆 1

Q: is there a specific reason that the tools.build guide -- https://clojure.org/guides/tools_build#_compiled_uberjar_application_build -- has prep and uber as separate tasks? Is there a specific reason to not have just uber and have it do all four things (write the pom, copy the source, compile the source, build the jar)?

(I'm looking at adding some shorthands to build-clj like I already have for jar)

Alex Miller (Clojure team) 2021-09-15T02:29:38.162100Z

you don’t need uber if you just want to use a git lib as a dep

Alex Miller (Clojure team) 2021-09-15T02:29:49.162500Z

prep is enough

Alex Miller (Clojure team) 2021-09-15T03:01:56.164100Z

Although maybe “prep as a git lib” and “uberjar” are unlikely to be the same project and I’m just trying to cram too many things into an example :)

Not sure why "write pom, copy files" is useful for a git lib? Can you elaborate?

"prep" to me means javac or perhaps some minor compile-clj stuff...