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(DefaultConf2ScopeMappingContainer.java:41)
        at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.createDependencyToScopeMap(DefaultPomDependenciesConverter.java:68)
        at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.convert(DefaultPomDependenciesConverter.java:48)
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getGeneratedDependencies(DefaultMavenPom.java:170)
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getEffectivePom(DefaultMavenPom.java:176)
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.writeTo(DefaultMavenPom.java:193)
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$2.execute(DefaultMavenPom.java:203)
        at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$2.execute(DefaultMavenPom.java:201)
        at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(IoActions.java:146)
        ... 104 more

You can see the full output at: http://paste.debian.net/1087703/

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