tools-build

roklenarcic 2024-08-12T18:31:35.262949Z

I am trying to make an uberjar, but I have a problem. Some dependencies have files in jar like LICENSE/listing.txt or some other file in LICENSE folder. Then I have com.cognitect.aws/license-manager which has LICENSE file and then I get an error due to uberjar operation trying to merge LICENSE file with LICENSE folder. Eg:

java.io.FileNotFoundException: /var/folders/fm/5mzhclpd7mj0tzjjq796ftc00000gn/T/uber3795519715075864758/LICENSE (Is a directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:212)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:154)
	at $fn__11617.invokeStatic(io.clj:229)
	at $fn__11617.invoke(io.clj:229)
	at $fn__11569$G__11523__11576.invoke(io.clj:69)
	at $fn__11591.invokeStatic(io.clj:165)
	at $fn__11591.invoke(io.clj:165)
	at $fn__11530$G__11519__11537.invoke(io.clj:69)
	at $reader.invokeStatic(io.clj:102)
	at $reader.doInvoke(io.clj:86)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$slurp.invokeStatic(core.clj:7009)
	at clojure.core$slurp.doInvoke(core.clj:7009)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.tools.build.tasks.uber$conflict_append_dedupe.invokeStatic(uber.clj:75)
	at clojure.tools.build.tasks.uber$conflict_append_dedupe.invoke(uber.clj:73)
	at clojure.tools.build.tasks.uber$handle_conflict.invokeStatic(uber.clj:126)
	at clojure.tools.build.tasks.uber$handle_conflict.invoke(uber.clj:117)
I’ve tried writing my own custom handler for conflict on ^LICENSE$ but it never gets called (because the build in handler gets matched first I assume). How would you approach this problem?

Alex Miller (Clojure team) 2024-08-12T18:36:56.795039Z

you can use :exclude ["LICENSE"] to exclude the LICENSE path

Alex Miller (Clojure team) 2024-08-12T18:37:43.452319Z

the conflict-handlers will only work to resolve two files that conflict