I am getting this error:
[main] INFO hf.depstar.uberjar - Building uber jar: example.jar
Execution error (ZipException) at java.util.zip.ZipInputStream/readEnd (ZipInputStream.java:409).
invalid entry CRC (expected 0xaf435a70 but got 0xee027fb2)
What could be the reason?
This is the clojure task:
:uberjar
{:replace-deps {seancorfield/depstar {:mvn/version "2.0.165"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true
:aliases [:prod]
:jar "example.jar"
:main-class "example.core"}}
@posobin Sounds like one of the JAR files it found on your project classpath is corrupted/invalid?
Can you share more of your deps.edn
file?
(you can also try :verbose true
which might let you see what file it fails on -- or referring to the debugging section of depstar
's README)
This is the whole deps.edn
With :verbose, it looks like .m2/repository/org/danielsz/lang-utils/0.1.3/lang-utils-0.1.3.jar is the culprit.
I can repro locally 🙂
And lang-utils is required by danielsz/system.
What could be the reason the jar file is broken?
No idea. It works fine with 0.1.2 but not 0.1.3
jar tvf
can open/read both.
In a minimal project, with just org.danielsz/lang-utils
added, I can build an uberjar with 0.1.2 but not with 0.1.3.
I'll create a depstar
issue and take a look in a while.
There's no differences in the sizes of any files in the two JARs for 0.1.2 and 0.1.3
This appears to be the only difference between 0.1.2 and 0.1.3: https://github.com/danielsz/lang-utils/commit/ad257138009f1548526181fa065ffdeeaa74bcca
@posobin If I update depstar
to ignore the exception, it seems to build a valid uberjar and the exception seems to happen right at the end of that lang-utils
JAR file. I'll create an issue based on this information. lein
seems happy with it so I'll take a look at how Leiningen consumes JAR files as well.
For now, I would recommend adding org.danielsz/lang-utils
as a top-level dependency with version "0.1.2"
since you already bring in a much more recent core.async
and that was the only change from 0.1.2 to 0.1.3 in lang-utils
.
Ok, thank you!
Looks like Leiningen treats the JAR as a generic ZIP file rather than a JAR file. Maybe that's why it doesn't care about the CRC error?
This worked! Just so I understand: this means danielsz/system will use the older version of the dependency, so potentially it could be bad, if there had been meaningful changes? Does the version in deps.edn always override any other ones?
The top-level deps override, yes.
There's no difference between 0.1.2 and 0.1.3, other than depending a slightly different version of core.async -- and you are already using a much more recent version of core.async (as a top-level dep), so that difference between 0.1.2 and 0.1.3 is irrelevant for you.