square / square/square-java-sdk
Maven builds get an empty okhttp jar
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 70
- フォーク
- 37
- 平均マージ
- 2時間 7分
- マージ済み PR(30日)
- 1
説明
Using
<dependency>
<groupId>com.squareup</groupId>
<artifactId>square</artifactId>
<version>47.0.1.20260715</version>
<scope>compile</scope>
</dependency>
The resulting jar gets an empty okhttp jar. We now need to add
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
<version>5.2.1</version>
</dependency>
for the build to work.
Some additional detail on the failure and root cause:
Symptom — any Maven-built app using SDK 47.x fails at runtime the first time a client is built:
java.lang.ClassNotFoundException: okhttp3.Interceptor
at com.squareup.square.core.ClientOptions.builder(ClientOptions.java:102)
at com.squareup.square.SquareClientBuilder.buildClientOptions(SquareClientBuilder.java:104)
at com.squareup.square.SquareClientBuilder.build(SquareClientBuilder.java:255)
Root cause — the SDK depends on com.squareup.okhttp3:okhttp 5.x, which is published as a Kotlin Multiplatform artifact. The root okhttp jar on Maven Central contains no classes (just META-INF/kotlin-project-structure-metadata.json); the real JVM classes live in okhttp-jvm.
Gradle resolves the redirect via Gradle Module Metadata, but Maven ignores .module files, so Maven consumers silently get the empty jar.
Per the OkHttp README (https://github.com/square/okhttp#requirements), "Maven projects must select between okhttp-jvm and okhttp-android" — see also square/okhttp#8913.
Suggested fix — declare com.squareup.okhttp3:okhttp-jvm in the SDK's published POM so the correct artifact flows transitively to Maven consumers. This is how OpenTelemetry resolved the identical breakage (open-telemetry/opentelemetry-java#7491), and it matches what okio itself does: okio's root POM declares okio-jvm as a plain compile dependency, which is why okio classes resolve fine under Maven while okhttp's don't.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue にある Maven 依存関係宣言で失敗を再現し、公開された POM とその推移的依存関係を調査します。ClientOptions.builder のスタックトレースをエントリーポイントとして使用します。完了の条件は、Maven コンシューマーが okhttp-jvm を推移的に受け取り、okhttp3.Interceptor に対する ClassNotFoundException が発生しなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, kotlin
- 領域
- build-system
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100