Skip to content

Publishing to sonatype fails with 401 #356

@Martmists-GH

Description

@Martmists-GH

I made sure to create a token and stored the credentials in my properties file, and I am sure they are set as username/password.

I configured the nexusPlugin as described in the readme:

nexusPublishing {
    repositories {
        sonatype {
            nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
            snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

            username = if (project.hasProperty("mavenCentralUser")) {
                project.properties["mavenCentralUser"] as? String
            } else {
                System.getenv("MAVEN_CENTRAL_USER")
            } ?: error("No maven user found")
            password = if (project.hasProperty("mavenCentralToken")) {
                project.properties["mavenCentralToken"] as? String
            } else {
                System.getenv("MAVEN_CENTRAL_TOKEN")
            } ?: error("No maven token found")
        }
    }
}

but I still get


> Task :initializeSonatypeStagingRepository FAILED
Caching disabled for task ':initializeSonatypeStagingRepository' because:
  Caching has not been enabled for the task
Task ':initializeSonatypeStagingRepository' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
No stagingProfileId set, querying for packageGroup 'com.martmists.ndarray-simd'
49 actionable tasks: 4 executed, 45 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':initializeSonatypeStagingRepository'.
> Failed to load staging profiles, server at https://s01.oss.sonatype.org/service/local/ responded with status code 401, body: 

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