tools.build v0.5.1 21da7d4 is now available • update to latest tools.deps.alpha 0.12.1048
Hi! I’m trying to build an uberjar and getting exception
Execution error (ExceptionInfo) at clojure.tools.build.tasks.uber/explode (uber.clj:172).
Cannot write META-INF/license/LICENSE.tomcat-native.txt from io.netty/netty-tcnative-boringssl-static as parent dir is a file from another lib. One of them must be excluded.
Is it possible to somehow identify which library brought “parent dir”?we had this issue. If you can run from a repl, the temp dir is still around ( i believe it is deleted on process exit) so you can go see. We found that there is a META-INF/LICENSE file and on case insensitive file systems (osx) this means that LICENSE and license/LICENSE cannot coexist
aha, thanks! will check
short of that i think you would need to create a basis and look through each jar for which one had the offending file and then report that
unfortunately at the point where that message is created, I do not know which lib explode put it on disk originally
but the right solution here is probably to add a conflict handler - there is one for licenses, but this is outside its regex
api doc is at https://clojure.github.io/tools.build/clojure.tools.build.api.html#var-uber
at the bottom you can see the default conflict handlers
{"^data_readers.clj[cs]?$" :data_readers
"^META-INF/services/" :append
"(?i)^(META-INF/)?(COPYRIGHT|NOTICE|LICENSE)(\.(txt|md))?$" :append-dedupe
:default :ignore}thanks btw there is a small mistake in that doc - :data-reader instead of :data_readers and “(?i)^(META-INF/)?(COPYRIGHT|NOTICE|LICENSE)(\.(txt|md))?$” should be “(?i)^(META-INF/)?(COPYRIGHT|NOTICE|LICENSE)(\\.(txt|md))?$”
fixed, the data-readers. the other is right (this is a string, not a regex so you need to escape the \, which will when turned into a regex will escape the .)
but clojure complains about Unsupported escape character: \. if I copy that map to the build file
oh, ha - it's "right" in the docstring, but being applied there so it shows up wrong in the docs :)
I need one additional level of escaping in the docstring :)
fixed
Thanks!
you can supply :conflict-handlers {"(?i)^META-INF/license/LICENSE.tomcat-native.txt" :append-dedupe}
same exception ( looks like this is the problem of MacOS filesystem
it looks like conflict handlers only get triggered when the same file already exists? if so i don't think it can help in this situation right?
right
oh right, sorry, I'm crossing things
this is the file/directory conflict
the problem is there is a file META-INF/license already on disk
so it can't make the directory META-INF/LICENSE/
so the only solution atm is to exclude one or the other file
yeah, it works after adding to :exclude list
@delaguardo We ran into that and it was coming from io.gprc/grpc-netty-shaded (I think) and we excluded that and added a dep on io.gprc/gprc-okhttp which is an alternate impl and that worked fine (and produced a smaller uberjar).
Yeah, here it is, from the Google Cloud Vision deps:
com.google.cloud/google-cloud-vision {:mvn/version "1.103.7"
:exclusions [io.grpc/grpc-netty-shaded]}
io.grpc/grpc-okhttp {:mvn/version "1.39.0"}