Fork me on GitHub
#tools-build
<
2023-03-23
>
kanwei14:03:03

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)14:03:56

this is a regex string, not a glob

Alex Miller (Clojure team)14:03:15

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

kanwei14:03:39

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

kanwei14:03:05

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

kanwei14:03:09

however that didn't work

kanwei14:03:21

oh it's file names only

Alex Miller (Clojure team)14:03:47

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

kanwei14:03:23

cool, deleting the path directly after copying works too

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

markaddleman17:03:57

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)17:03:47

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

markaddleman17:03:33

Got it. Thanks

markaddleman17:03:52

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)17:03:38

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

markaddleman17:03:01

Yeah, I figured as much. Thanks for the pointer

dpsutton17:03:11

@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)17:03:20

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

👍 2