apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

`maven-publish` doesn't play well with `-apollo` modules generated when `generateApolloMetadata` is used

Open benoitletondor opened this issue 2 years ago • 1 comments

Summary

When trying to publish a new version of our SDK with a :core module having a service using generateApolloMetadata and another module ( :messaging-core ) depending on that module, we ran into an issue preventing the build:

Could not determine the dependencies of task ':messaging-core:publishReleasePublicationToMavenLocal'.
> Publishing is not able to resolve a dependency on a project with multiple publications that have different coordinates.
  Found the following publications in project ':core':
    - Maven publication 'release' with coordinates xxx.xxx.sdk:core:y
    - Maven publication 'apollo' with coordinates xxx.xxx.sdk:core-apollo:y

Version

3.5.0

Logs

https://jitpack.io/com/github/nabla/nabla-android/2a1f725fb6/build.log

More details

This is not an apollo issue, more of a gradle/maven plugin one, more details in the gradle issue: https://github.com/gradle/gradle/issues/1061

We found a workaround setting apollo modules as alias: https://github.com/nabla/nabla-android/blob/main/core/build.gradle#L95

benoitletondor avatar Aug 19 '22 14:08 benoitletondor

Good catch. It's exactly this Gradle issue: https://github.com/gradle/gradle/issues/16123

I'm a bit puzzled what the best fix for this is. Maybe we could "just" publish the apolloMetadata.json as part of the default publication. I didn't want to do this initially because that's touching the user publication but it might be an easier setup ultimately.

Something else we could look into is the Kotlin multiplatform plugin. They typically publish several publication at different coordinates and it looks like it's working fine 🤔 . So maybe there's some inspiration to get from there.

martinbonnin avatar Aug 24 '22 15:08 martinbonnin

For the record, v4 will only expose a Gradle software component and let users configure publications as needed and should therefore fix this issue.

martinbonnin avatar Feb 28 '23 12:02 martinbonnin

@benoitletondor any chance you could try the v4 snapshots? Did it fix this issue?

martinbonnin avatar Dec 07 '23 14:12 martinbonnin

Hey @martinbonnin , very sorry but my company (and myself) moved to another project where we don't use Apollo Kotlin anymore so I don't have a way of testing that right now :( very sorry

benoitletondor avatar Dec 07 '23 15:12 benoitletondor

No worries, thanks for the quick reply!

I'll close it for now and reopen if that ever becomes an issue again

martinbonnin avatar Dec 07 '23 15:12 martinbonnin