tools-build 2023-03-23

I want to exclude the shadow-cljs build folder from my uberjar. The path is resources/public/js/cljs-runtime. I've tried this but it still adds all the files:

(b/uber {:class-dir class-dir
           :uber-file uber-file
           :basis     basis
           :main      'doublethedonation.core
           :exclude   ["LICENSE" "public/js/cljs-runtime/*"]})

Alex Miller (Clojure team) 2023-03-23T14:26:56.819659Z

this is a regex string, not a glob

Alex Miller (Clojure team) 2023-03-23T14:27:15.804999Z

"public/js/cljs-runtime/.*" maybe?

dope, "public/js/cljs-runtime/.*" worked thanks

I tried just not copying the folder instead,

(b/copy-dir {:src-dirs   ["src-clj" "src-cljs" "src-cljc" "resources"]
               :target-dir class-dir
               :ignores ["public/js/cljs-runtime/.*"]})

however that didn't work

oh it's file names only

Alex Miller (Clojure team) 2023-03-23T14:36:47.864189Z

yeah, that's more for excluding things like editor backup files

cool, deleting the path directly after copying works too

(b/delete {:path "target/classes/public/js/cljs-runtime"})

When building my uberjar, I’m getting

Execution error (ExceptionInfo) at clojure.tools.build.tasks.uber/explode1 (uber.clj:164).
Cannot write META-INF/license/LICENSE.aix-netbsd.txt from io.grpc/grpc-netty-shaded as parent dir is a file from another lib. One of them must be excluded.
What is an easy way to discover where the conflict is coming from? Once I do, how would I fix this problem? This is for an internal service, so I don’t really need to include the license files. How would I ignore this error?

Alex Miller (Clojure team) 2023-03-23T17:48:47.188979Z

https://clojure.github.io/tools.build/clojure.tools.build.api.html#var-uber - add :exclude ["META-INF/license/LICENSE.aix-netbsd.txt"] to your uber invocation

Got it. Thanks

fwiw, it was a little confusing which “exclusions” the message refers to. I thought it was talking about classpath exclusions specified in deps.edn. Of course, on a little reflection, it makes sense that it’s talking about the uber task

Alex Miller (Clojure team) 2023-03-23T17:49:38.200669Z

the source is likely many libs that have a file META-INF/license that conflicts with the META-INF/license/ dir in io.grpc/grpc-netty-shaded

Yeah, I figured as much. Thanks for the pointer

@alexmiller i remember a while back you mentioned you might switch tools.build to pull directly from jars rather than exploding them onto disk. This change would alleviate this issue above. Do you know if that is still on the roadmap?

Alex Miller (Clojure team) 2023-03-23T17:58:20.882809Z

still an option to consider, but not something I'm likely to look at imminently

👍 1