depstar

Discussion around https://github.com/seancorfield/depstar
Gleb Posobin 2021-02-04T14:52:50.059600Z

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

seancorfield 2021-02-04T19:09:42.060400Z

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

seancorfield 2021-02-04T19:09:52.060700Z

Can you share more of your deps.edn file?

seancorfield 2021-02-04T19:10:31.061600Z

(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 Posobin 2021-02-04T23:04:57.061700Z

This is the whole deps.edn

Gleb Posobin 2021-02-04T23:09:58.062400Z

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

seancorfield 2021-02-04T23:11:09.062800Z

I can repro locally 🙂

👍 1
Gleb Posobin 2021-02-04T23:12:48.063300Z

And lang-utils is required by danielsz/system.

Gleb Posobin 2021-02-04T23:13:41.063800Z

What could be the reason the jar file is broken?

seancorfield 2021-02-04T23:14:41.064200Z

No idea. It works fine with 0.1.2 but not 0.1.3

seancorfield 2021-02-04T23:14:49.064500Z

jar tvf can open/read both.

seancorfield 2021-02-04T23:16:52.065200Z

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.

seancorfield 2021-02-04T23:17:06.065600Z

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

seancorfield 2021-02-04T23:18:18.066200Z

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

seancorfield 2021-02-04T23:19:40.066600Z

This appears to be the only difference between 0.1.2 and 0.1.3: https://github.com/danielsz/lang-utils/commit/ad257138009f1548526181fa065ffdeeaa74bcca

seancorfield 2021-02-04T23:30:57.068400Z

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

👍 1
seancorfield 2021-02-04T23:32:45.068600Z

https://github.com/seancorfield/depstar/issues/66

seancorfield 2021-02-04T23:33:55.069800Z

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 Posobin 2021-02-04T23:34:22.070Z

Ok, thank you!

seancorfield 2021-02-04T23:36:30.070700Z

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 Posobin 2021-02-04T23:54:29.072600Z

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?

seancorfield 2021-02-04T23:57:18.072800Z

The top-level deps override, yes.

seancorfield 2021-02-04T23:58:30.074100Z

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.