Gradle fails to create POM with "The configuration to scope mapping is not unique."

Since a few weeks (and probably gradle versions), I am unable to upload the archives to Maven Central. If I don’t invoke gradle with --stacktrace I get

$ gradle uploadArchives
> Task :smack-android:uploadArchives FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':smack-android:uploadArchives'.
> Could not publish configuration 'archives'
   > Could not write to file '/home/flo/data/code/smack/smack-android/build/poms/pom-default.xml'.

using --stacktrace yields

Caused by: org.gradle.api.InvalidUserDataException: The configuration to scope mapping is not unique. The following configurations have the same priority: [org.gradle.api.artifacts.maven.Conf2ScopeMapping@856ed98c, org.gradle.api.artifacts.maven.Conf2ScopeMapping@62c4ce18]
        at org.gradle.api.publication.maven.internal.pom.DefaultConf2ScopeMappingContainer.getMapping(
        at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.createDependencyToScopeMap(
        at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.convert(
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getGeneratedDependencies(
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getEffectivePom(
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.writeTo(
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$2.execute(
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$2.execute(
        at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(
        ... 104 more

You can see the full output at:

I am using Gradle 4.4.1 to upload the archives of the FOSS library Smack.

I am not sure what the cause of this is, as I don’t remember changing anything related to POM configuration in Smack recently. Any help or pointers in the right direction to solve this is appreciated.

1 Like

Getting the same error here today. Did you ever figure it out?

fixed it for me.

1 Like