Search code examples
gradletravis-cisonatypemaven-central

Gradle uploadArchives from Travis mangles staging repositories


I have an open source project that hooks to travis-ci.org and that builds with gradle.

This project uses the gradle maven plugin to upload release artifacts to oss.sonatype.org using the uploadArchives target. What usually happens is that this target creates a single staging repository in Sonatype, then the Gradle nexus staging plugin promotes the repository and it shows up in Maven Central a few minutes later.

However, recently, the uploadArchives target started creating multiple staging repositories, each with a partial subset of the artifacts needed; and that happens only when run in Travis, not when I try from a laptop.

Repository list

What am I missing here, which makes it work locally when running ./gradlew uploadArchives, but fail in Travis?

A few links which might help:


Solution

  • In the end it appears this is a common error that started appearing this year. Travis VMs with sudo: enabled or docker will change IP addresses between artifact uploads and this will prompt Sonatype to think those artifacts belong to different repositories. Adding this to my travis.yml fixed it:

    sudo: false
    dist: trusty