Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

okio as a dependency changed artifactId in 4.10.x release #7351

Closed
honnix opened this issue Jun 22, 2022 · 9 comments
Closed

okio as a dependency changed artifactId in 4.10.x release #7351

honnix opened this issue Jun 22, 2022 · 9 comments
Labels
bug Bug in existing code

Comments

@honnix
Copy link

honnix commented Jun 22, 2022

Since 4.10.0 release, okio, as a dependency, has been changed to okio-jvm from okio. https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.10.0 vs https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/4.9.3

This is problematic because build tools like maven and gradle will treat them as two different artifacts and pull both of them as dependencies.

As an example:

  <dependencies>
    <dependency>
      <groupId>com.squareup.okio</groupId>
      <artifactId>okio</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>4.10.0</version>
    </dependency>
  </dependencies>

Will result in both okio-2.9.0.jar and okio-jvm-3.0.0.jar being pulled in as dependencies, while otherwise build tools will only pick up one of those (version resolution is a different story and things like maven-enforcer-plugin will not help in this case). The problem gets harder to be discovered if okio is introduced as a transitive dependency by another artifact.

We also noticed this was reverted in 5.x, see https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/5.0.0-alpha.9. So maybe this was introduced accidentally?

@honnix honnix added the bug Bug in existing code label Jun 22, 2022
@klaraward
Copy link

Also related square/okio#1067 (comment) and square/okio#1121

@klaraward
Copy link

This is the PR that bumped okio from 2.9 to 3 - #7225

@honnix honnix changed the title Dependency of okio changed artifactId in 4.10.x release okio as a dependency changed artifactId in 4.10.x release Jun 22, 2022
@yschimke
Copy link
Collaborator

Fixed in #7354

@honnix
Copy link
Author

honnix commented Jun 27, 2022

@yschimke Thanks for looking into this.

Could you please help me understand how #7354 fixes this issue? As I understood #7354 creates a dependency from okhttp to okhttp-jvm so current Maven users depending on okhttp will not need to change their dependency when upgrading to later okhttp version.

However, since okhttp-jvm depends on okio-jvm, Maven users having both okio and okhttp as dependencies will still end up with pulling in both okio and okio-jvm into classpath, is the right?

Also I see the PR was made towards the main branch so 4.x will not get it.

Let me try to understand the path moving forwards. Is it true starting from okhttp 5.x, using okhttp-jvm together with okio-jvm is the correct way for JVM platform? If that is the case I think #7354 might not help create the awareness.

Was it intended to introduce the similar change to 4.10.x (depending on okio-jvm)? I can understand having this type of change in a major release, but for a minor release it seems too aggressive. Is it possible to revert upgrading okio in 4.10.x?

Thanks again for looking into this issue.

@honnix
Copy link
Author

honnix commented Jun 27, 2022

OK I see https://square.github.io/okio/changelog/#version-320 (square/okio#1125) has a similar change. So maybe you could release 4.10.1 to depend on okio-3.2.0 instead of okio-jvm-3.0.0?

@yschimke yschimke reopened this Jun 27, 2022
@yschimke
Copy link
Collaborator

Yep, sorry, you are right, will require a bump and release.

@honnix
Copy link
Author

honnix commented Jun 27, 2022

Thank you so much! Looking forwards to a new release. Also thanks for working on the workaround to help users migrate.

@swankjesse
Copy link
Member

swankjesse commented Jun 27, 2022

Yep! I wanna release 4.11.0 that depends on Okio 3.2.0.

@tianshuang
Copy link

tianshuang commented Sep 13, 2022

Yep! I wanna release 4.11.0 that depends on Okio 3.2.0.

@swankjesse When will 4.11.0 be released to fix this?

Our project has both okio:1.12.0 and okio-jvm:3.0.0. When util.kt loads the okio.Options class in okio:1.12.0, it will trigger java.lang.NoSuchFieldError: Companion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

5 participants