okio icon indicating copy to clipboard operation
okio copied to clipboard

3.4.0 module name problems

Open barchetta opened this issue 1 year ago • 3 comments

In 3.4.0:

  • okio-3.4.0.jar has no Automatic-Module-Name specified. Therefore its derived module name is okio
  • okio-jvm-3.4.0.jar has Automatic-Module-Name: okio . Therefore its module name is also okio

When you try to run an application with both of those jar's on the module path (java --module-path) you get an error:

java.lang.module.FindException: Two versions of module okio found in target/libs (okio-3.4.0.jar and okio-jvm-3.4.0.jar)

In 1.17.5 there is no okio-jvm-*.jar and okio-*.jar has Automatic-Module-Name: okio and this problem did not exist.

barchetta avatar Jul 24 '23 23:07 barchetta

As a workaround I recommend excluding the non-JVM artifact from your module path.

swankjesse avatar Jul 26 '23 03:07 swankjesse

I ran in to this problem in a modular Java application that uses OkHttp.

I suggest this simple solution to the okio developers: Add an "Automatic-Module-Name" entry to the manifest of okio-x.x.x.jar also. Call it for example okio-top-level. Then the two module names will not conflict any more.

jensli avatar Dec 06 '23 12:12 jensli

That would not be enough.

Not only do those two jars have the same inferred module name, they both have classes in the okio package. This is a split package and will just never work on the module path.

This requires a deeper fix.

bowbahdoe avatar Jul 09 '24 02:07 bowbahdoe