tools-build

2023-03-23T14:25:03.753189Z

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?

2023-03-23T14:34:39.160449Z

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

2023-03-23T14:35:05.708409Z

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/.*"]})

2023-03-23T14:35:09.057589Z

however that didn't work

2023-03-23T14:35:21.355809Z

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

2023-03-23T14:38:23.821509Z

cool, deleting the path directly after copying works too

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

markaddleman 2023-03-23T17:46:57.609319Z

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

markaddleman 2023-03-23T17:49:33.283329Z

Got it. Thanks

markaddleman 2023-03-23T17:50:52.427279Z

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

markaddleman 2023-03-23T17:50:01.329419Z

Yeah, I figured as much. Thanks for the pointer

dpsutton 2023-03-23T17:56:11.085459Z

@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