Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19854

Unable to publish artifact to mavenCentral

$
0
0

I’m trying to upload one of my libraries to mavenCentral, but I’m stuck on the upload step.

I’ve taken example from this link: https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:complete_example, I only changed this line: artifactId = archivesBaseName and setting the repositories as following:

repositories {
        maven {
            def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
            def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl

            credentials {
                username ossrhUsername
                password ossrhPassword
            }
        }
    }

The version is set to 1.0-SNAPSHOT

When running publish though I get the following output:

Version: 1.0-SNAPSHOT
> Task :jar:compileJava UP-TO-DATE
> Task :jar:processResources NO-SOURCE
> Task :jar:classes UP-TO-DATE
> Task :jar:jar UP-TO-DATE
> Task :jar:generateMetadataFileForMavenJavaPublication
> Task :jar:generatePomFileForMavenJavaPublication
> Task :jar:javadoc UP-TO-DATE
> Task :jar:javadocJar UP-TO-DATE
> Task :jar:sourcesJar UP-TO-DATE
> Task :jar:signMavenJavaPublication FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jar:signMavenJavaPublication'.
> Signing Gradle Module Metadata is not supported for snapshot dependencies.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jar:signMavenJavaPublication'.
// more of the stacktrace

After some further research I’ve found a (supposed) solution, to change signing as following:


signing {
    required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
    sign publishing.publications.mavenJava
}

But this still keeps showing the same error. If I remove the signing block then the publish task succeeds, however I’m met with another problem; my artifacts appear in the search tab on sonatype, but not in “staging repositories”, which is empty. I’m guessing it’s the signing, but I am not sure how to confirm/deny this.

How can I resolve this issue?

I’m using Java 13, with Gradle 6.0-rc-1.


Viewing all articles
Browse latest Browse all 19854

Trending Articles