Skip to content

Commit ea4b556

Browse files
authored
Replace okhttp with okhttp-jvm in published maven pom (#2094)
1 parent de6ed98 commit ea4b556

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

buildSrc/src/main/kotlin/otel.publish-conventions.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ publishing {
5757
developerConnection.set("scm:git:[email protected]:open-telemetry/opentelemetry-java-contrib.git")
5858
url.set("[email protected]:open-telemetry/opentelemetry-java-contrib.git")
5959
}
60+
61+
withXml {
62+
// Since 5.0 okhttp uses gradle metadata to choose either okhttp-jvm or okhttp-android.
63+
// This does not work for maven builds that don't understand gradle metadata. They end up
64+
// using the okhttp artifact that is an empty jar. Here we replace usages of okhttp with
65+
// okhttp-jvm so that maven could get the actual okhttp dependency instead of the empty jar.
66+
var result = asString()
67+
var modified = result.toString().replace(">okhttp<", ">okhttp-jvm<")
68+
result.clear()
69+
result.append(modified)
70+
}
6071
}
6172
}
6273
}

0 commit comments

Comments
 (0)