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

Artifact coordinates changed in 5.x releases for Maven users #7339

Closed
robertvazan opened this issue Jun 17, 2022 · 4 comments
Closed

Artifact coordinates changed in 5.x releases for Maven users #7339

robertvazan opened this issue Jun 17, 2022 · 4 comments
Labels
bug Bug in existing code

Comments

@robertvazan
Copy link

Could you provide guidance on how to deal with okhttp-jvm/okhttp JAR mixup? Given app A and library L, both upgrade paths are perilous:

App first: A -> L + okhttp-jvm:5, L -> okhttp:4
Library first: A -> L + okhttp:4, L -> okhttp-jvm:5

Both cases get resolved by maven to A -> okhttp:4 + okhttp-jvm:5, which will result in class loading conflicts at runtime.

From library point of view, no matter which version of okhttp is chosen, some dependent apps will end up with broken build. It looks like the only solution is to bundle okhttp under library's package tree. Or am I missing something?

@swankjesse
Copy link
Member

Yeah sorry about this. We're using gradle everywhere which papers over this problem. Will look into building a better story for Maven users.

@yschimke
Copy link
Collaborator

yschimke commented Jun 19, 2022

Is this the fix? https://kotlinlang.slack.com/archives/C3PQML5NU/p1655635540306199

publishing {
    publications {
        val jvm = getByName<MavenPublication>("jvm")
        getByName<MavenPublication>("kotlinMultiplatform") {
            pom.withXml {
                val root = asNode()
                val dependencies = ((root["dependencies"] as NodeList).firstOrNull() as Node?)?.apply {
                    for (child in children().toList()) remove(child as Node)
                } ?: root.appendNode("dependencies")
                dependencies.appendNode("dependency").apply {
                    appendNode("groupId", jvm.groupId)
                    appendNode("artifactId", jvm.artifactId)
                    appendNode("version", jvm.version)
                    appendNode("scope", "compile")
                }
            }
        }
    }
}

@JakeWharton
Copy link
Member

That would depend on what the type and contents of the binary for the multiplatform artifact was. Seems like a better option would be to change the suffixes to have the JVM artifact the unqualified one with the Gradle module metadata.

@swankjesse swankjesse changed the title No clean upgrade path to 5.x Artifact coordinates changed in 5.x releases for Maven users Jun 22, 2022
@swankjesse
Copy link
Member

I’m gonna try doing this on both OkHttp and Okio
#7354
square/okio#1125

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

4 participants