Repository navigation
deps(java): bump okhttp 4.12.0 -> 5.4.0, and move to the artifact that has the classes - #333
Conversation
…t has the classes
OkHttp 5 went multiplatform and split the artifact. `com.squareup.okhttp3:okhttp:5.4.0` is a
stub: `unzip -l okhttp-5.4.0.jar | grep -c '\.class'` returns 0. The JVM classes moved to
`com.squareup.okhttp3:okhttp-jvm`, which has 330.
So the version bump alone cannot work — it fails `src/main` with `package okhttp3 does not
exist`, which reads like a sweeping API break rather than a renamed artifact. Two things hid
what was really going on:
- `src/test` compiles either way. `mockwebserver` depends on `okhttp-jvm` transitively, so
the classes were already on the test classpath; only `compile` scope was missing them.
- the error names the package, not the artifact, so the obvious next move is to go looking
for renamed OkHttp APIs. There are none to find. No source file changes in this commit,
and all 17 tests pass unmodified.
This is why #291 could never be merged as opened, and why rebasing it would not have helped:
Dependabot bumps versions, and this release moved the coordinates. The two edits have to be in
one commit or neither is correct — which is a shape worth recognising the next time a major
"breaks the build" in a way no upgrade guide explains.
Verified:
$ unzip -l ~/.m2/.../okhttp-5.4.0.jar | grep -c '\.class' -> 0
$ unzip -l ~/.m2/.../okhttp-jvm-5.4.0.jar | grep -c '\.class' -> 330
$ mvn -B dependency:tree | grep -i okhttp
+- com.squareup.okhttp3:okhttp-jvm:jar:5.4.0:compile
+- com.squareup.okhttp3:mockwebserver:jar:5.4.0:test
$ mvn -B test
Tests run: 17, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
The `mvn -B test` CI step added in #327 is what turns this class of breakage into a failing
check instead of a silent one; before it, nothing in this repository had ever run Maven.
Closes #291.
9c63032 to
b1274c2
Compare
|
Rebased onto Re-verified after the rebase: The substance is unchanged from the description: Still not merging this myself. My standing authority covers closing Dependabot PRs, not merging my own replacements. |
Replaces #291, which could not be merged as opened. Closes #291.
The bump alone cannot work
com.squareup.okhttp3:okhttp:5.4.0contains zero.classfiles. OkHttp 5 wentmultiplatform and split the artifact; the JVM classes moved to
com.squareup.okhttp3:okhttp-jvm, which has 330.So #291's version-only change fails
src/mainwithpackage okhttp3 does not exist. This PRmakes both edits in one commit:
okhttp.version4.12.0 → 5.4.0 andartifactIdokhttp→okhttp-jvm.Two things that hid the real cause
src/testcompiles either way.mockwebserverpullsokhttp-jvmin transitively, so theclasses were already on the test classpath — only
compilescope was missing them. Atest-only run would have looked fine.
renamed OkHttp APIs. There are none. No source file changes in this PR, and all 17 tests
pass unmodified.
Why Dependabot could never fix this itself
Dependabot bumps versions; this release moved the coordinates. The two edits have to land
together or neither is correct — rebasing #291 any number of times would not have produced a
working commit. Worth recognising the next time a major "breaks the build" in a way no upgrade
guide explains.
Verification
Note
okhttp-jvmis now atcompilescope, where before it appeared only undertest.The
mvn -B testCI step added in #327 is what makes this a failing check rather than a silentbreakage — before it, nothing in this repository had ever run Maven, which is how the SDK's four
compile errors shipped in the first place.