Skip to content

Socket timeout when publishing via Portal OSSRH Staging API #398

@mmoayyed

Description

@mmoayyed

Thank you very much for this plugin.

Setup

I am using the following Gradle version:

------------------------------------------------------------
Gradle 9.0.0-rc-3
------------------------------------------------------------

Build time:    2025-07-17 12:48:00 UTC
Revision:      2db9560bb68c367a265b10516c856c840f9bed8d

Kotlin:        2.2.0
Groovy:        4.0.27
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  21.0.8 (Azul Systems, Inc. 21.0.8+9-LTS)
Daemon JVM:    /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home (no JDK specified, using current Java home)
OS:            Mac OS X 15.5 aarch64

...and using version 2.0.0 of the plugin here:

apply plugin: "io.github.gradle-nexus.publish-plugin"


nexusPublishing {
    packageGroup = "org.apereo"
    repositories {
        sonatype {
            username = "${repositoryUsername}"
            password = "${repositoryPassword}"
            nexusUrl.set(uri("${releaseRepositoryUrl}"))
            snapshotRepositoryUrl.set(uri("${snapshotsRepositoryUrl}"))
        }
    }

    clientTimeout = java.time.Duration.ofSeconds(120)
    connectTimeout = java.time.Duration.ofSeconds(120)
    transitionCheckOptions {
        maxRetries.set(100)
        delayBetween.set(java.time.Duration.ofSeconds(60))
    }
}

The URLs are defined as such:

releaseRepositoryUrl=https://ossrh-staging-api.central.sonatype.com/service/local/
snapshotsRepositoryUrl=https://central.sonatype.com/repository/maven-snapshots/

Problem

I am running the following task:

    ./gradlew publishToSonatype closeAndReleaseStagingRepository \
      --no-build-cache --no-daemon --no-parallel --no-watch-fs --no-configuration-cache \
      -DskipAot=true -DpublishReleases=true \
      -DrepositoryUsername="..." -DrepositoryPassword="..." \
      -Dorg.gradle.internal.http.socketTimeout=640000 \
      -Dorg.gradle.internal.http.connectionTimeout=640000 \
      -Dorg.gradle.internal.publish.checksums.insecure=true \
      -Dorg.gradle.internal.network.retry.max.attempts=5 \
      -Dorg.gradle.internal.network.retry.initial.backOff=5000

...this results in the following error:

* What went wrong:
Execution failed for task ':closeSonatypeStagingRepository'.
> java.net.SocketTimeoutException: timeout

Full error: https://pastebin.com/6eprimEp

This is a project that has a large number of subprojects. Is there a different timeout that one can or should set?

Note: token is valid and the publishing process has worked without an issue using the legacy service. This is now surfaced up when using the Portal OSSRH Staging API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions