{
"$type": "site.standard.document",
"canonicalUrl": "https://numergent.com/2015-03/Chasing-after-NoSuchMethodError-com-google-common-io-ByteStreams-limit.html",
"path": "/2015-03/Chasing-after-NoSuchMethodError-com-google-common-io-ByteStreams-limit.html",
"publishedAt": "2015-03-24T07:57:26.000Z",
"site": "at://did:plc:cf6futaebyc2k4wgzsr4v42k/site.standard.publication/3mp2ewx43js2g",
"tags": [
"clojure",
"lein uberjar",
"urly",
"leiningen"
],
"textContent": "This one bit me a bit hard and, seeing as I could find only _one_ reference for it in the context of Clojure and Leiningen, I thought a small write-up would help.\n\nAfter including some ClojureScript code on my project, lein started barfing when I attempted to build an uberjar with any optimization settings other than _none_.\n\n\tException in thread “main” java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.limit(Ljava/io/InputStream;J)Ljava/io/InputStream;, compiling:(/private/var/folders/64/ckdtdxm14059n9wh8rhf1mvw0000gn/T/form-init527739448955044836.clj:1:123)\n\t\nThere was only one obscure reference I found, from an IRC chat now a couple of years old. My first thought was that something in the ClojureScript code was throwing off the compiler, but it seemed odd that this would trigger a call to a specific non-existent method.\n\nOther searches - outside of the lein context - made me realize it was actually a dependency conflict, and only triggered on uberjar because since there wasn’t any ClojureScript code deployed before the compiler hadn’t had to be invoked.\n\nCalling\n\n\tlein deps :tree\n\nshowed there were multiple versions of com.google.guava being referenced, with the one used by ClojureScript being 18.0 but a much older 11.0.1 being referenced by urly. Seems like lein either doesn’t realize there’s a conflict or defaults to the older library, which was causing the error when ClojureScript attempted to build.",
"title": "Chasing after NoSuchMethodError: com.google.common.io.ByteStreams.limit"
}