This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-27
Channels
- # announcements (2)
- # aws (31)
- # babashka (81)
- # beginners (82)
- # calva (38)
- # clj-kondo (41)
- # cljdoc (4)
- # cljs-dev (6)
- # clojure (101)
- # clojure-belgium (1)
- # clojure-europe (30)
- # clojure-germany (1)
- # clojure-italy (7)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-uk (19)
- # clojurescript (16)
- # clojutre (1)
- # community-development (26)
- # core-logic (2)
- # data-science (26)
- # datomic (71)
- # events (3)
- # fulcro (55)
- # graalvm (2)
- # graphql (3)
- # joker (2)
- # kaocha (19)
- # luminus (2)
- # malli (6)
- # meander (3)
- # off-topic (6)
- # pathom (34)
- # random (1)
- # re-frame (2)
- # robots (1)
- # shadow-cljs (37)
- # sql (30)
- # tools-deps (21)
- # xtdb (4)
- # yada (25)
Using Sean Corfield's fork of depstar
, and running the command clj -A:uberjar x.jar
, I get
Building uber jar: x.jar
{:warning "clashing jar item", :path "META-INF/services/com.fasterxml.jackson.core.JsonFactory", :strategy :concat-lines}
{:warning "clashing jar item", :path "META-INF/services/com.fasterxml.jackson.core.JsonFactory", :strategy :concat-lines}
I know it is just a warning, but what do I do to fix it? My deps.edn
is
{:paths ["src"] ;until TDEPS-52 is fixed
:aliases
{:test
{:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "RELEASE"}}}
:runner
{:extra-deps
{com.cognitect/test-runner
{:git/url ""
:sha "76568540e7f40268ad2b646110f237a60295fa3c"}}
:main-opts ["-m" "cognitect.test-runner" "-d" "test"]}}
:deps
{
cheshire {:mvn/version "5.10.0"}
http-kit {:mvn/version "2.3.0"}
org.clojure/clojure {:mvn/version "1.10.1"}
}
}
If this is not the appropriate channel, please redirect me. Thanks.You don't do anything to fix it. It's just warning you, so you know that the same file is being copied into your JAR multiple times (and it is handling it by concatenating the files). Jackson is a horribly problematic library -- it is the cause of most of the version conflicts we see people run into these days but unfortunately it's also fairly ubiquitous so...
I'm a bit surprised you're seeing the message twice -- that implies three copies of the file are being found on the classpaths...
The 1.0.x version of depstar
(currently on master) will have a -S
/ --suppress-clash
option to hide that warning message(!) but you can currently use the -v
/ --verbose
option to learn more about what it is bringing in @dorab
OK, I've repro'd based on your deps.edn
and it looks like each of the three Jackson libraries being pulled in by Cheshire all contain that same file.
Yup, seems like each of the Jackson JAR files (core, databind-cbor, and databind-smile) all contain that file and it has a class name in it that matches one in the library it comes from. I'm fairly certain this is harmless and "expected behavior". Perhaps @ghadi can confirm when he is next around, since he's the original author of the first version of depstar
...?
(this seems like another reason to try using clojure.data.json
instead of cheshire
🙂 )
Thanks @seancorfield. I will try to use clojure.data.json
instead.
If the same file is being requested multiple times, could depstar
just include it once? Sorry if I'm being naive.
No, the same named file is included in three different libraries.
As I said above, Cheshire pulls in Jackson, and that means you get its core, cbor, and smile libs (dataformat, not databind, my bad -- rest of it still applies). Each of those three libs includes the same file. depstar
concatenates the lines in each file to create a single file in the resulting JAR.
Interestingly, dataformat-smile and dataformat-cbor are both deprecated and archived. Ah, looks like dataformat-binary is the replacement for both of those now. Sheesh, that is one weird, troublesome library...
Hello all, how to convert this lein uberjar
:main ^:skip-aot app.core
:uberjar-name "project.jar"
:profiles {:uberjar {:aot :all}}
It has an example in the readme
# generate pom.xml (or create it manually)
clojure -Spom
# build the uberjar with AOT compilation
clojure -A:depstar -m hf.depstar.uberjar MyProject.jar -C -m project.core
# Main-Class: project.core
java -jar MyProject.jar
(use project.jar
instead of MyProject.jar
and app.core
instead of project.core
)
You'll need to edit the pom.xml
generated by clojure -Spom
to add more stuff. Take a look at a pom.xml
file generated by clj-new
(if you created your project with a recent version of clj-new
and the app
template, then the pom.xml
file will probably be almost 100% of what you would need for depstar
and deployment to Clojars anyway).
@seancorfield I tried -A:uberjar
from your dot-clojure but I didn´t know about pom.xml