Fork me on GitHub
#depstar
<
2021-02-04
>
Gleb Posobin14:02:50

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"}}

seancorfield19:02:42

@posobin Sounds like one of the JAR files it found on your project classpath is corrupted/invalid?

seancorfield19:02:52

Can you share more of your deps.edn file?

seancorfield19:02:31

(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)

Gleb Posobin23:02:57

This is the whole deps.edn

Gleb Posobin23:02:58

With :verbose, it looks like .m2/repository/org/danielsz/lang-utils/0.1.3/lang-utils-0.1.3.jar is the culprit.

seancorfield23:02:09

I can repro locally 🙂

👍 3
Gleb Posobin23:02:48

And lang-utils is required by danielsz/system.

Gleb Posobin23:02:41

What could be the reason the jar file is broken?

seancorfield23:02:41

No idea. It works fine with 0.1.2 but not 0.1.3

seancorfield23:02:49

jar tvf can open/read both.

seancorfield23:02:52

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.

seancorfield23:02:06

I'll create a depstar issue and take a look in a while.

seancorfield23:02:18

There's no differences in the sizes of any files in the two JARs for 0.1.2 and 0.1.3

seancorfield23:02:57

@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.

👍 3
seancorfield23:02:55

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.

Gleb Posobin23:02:22

Ok, thank you!

seancorfield23:02:30

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?

Gleb Posobin23:02:29

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?

seancorfield23:02:18

The top-level deps override, yes.

seancorfield23:02:30

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.