Closed yashctn88 closed 8 months ago
facing same issue
Hi @yashctn88 unfortunately this isn't the right place to get the help you need.
This issue tracker is specifically for deployments of Nexus Repository OSS. Per (https://central.sonatype.org/news/20240109_issues_sonatype_org_deprecation/):
Registration and Namespace Requests Users new to publishing via Maven Central will need to register via central.sonatype.com.
Support Requests All other support requests will go through our central-support@sonatype.com email.
This is the content of my build.gradle.kts file
import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.bundling.Jar import java.util.*
plugins { id("maven-publish") id("signing") }
// Stub secrets to let the project sync and build without the publication values set up ext["signing.keyId"] = null ext["signing.password"] = null ext["signing.secretKeyRingFile"] = null ext["ossrhUsername"] = null ext["ossrhPassword"] = null
// Grabbing secrets from local.properties file or from environment variables, which could be used on CI val secretPropsFile = project.rootProject.file("local.properties") if (secretPropsFile.exists()) { secretPropsFile.reader().use { Properties().apply { load(it) } }.onEach { (name, value) -> ext[name.toString()] = value } } else { ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID") ext["signing.password"] = System.getenv("SIGNING_PASSWORD") ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE") ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME") ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD") }
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") }
fun getExtraString(name: String) = ext[name]?.toString()
publishing { // Configure maven central repository repositories { maven { isAllowInsecureProtocol = true name = "sonatype" var repositoryUrl = "" repositoryUrl = if (version.toString().endsWith("SNAPSHOT")) { "https://s01.oss.sonatype.org/content/repositories/snapshots/" } else { "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" }
}
// Signing artifacts. Signing.* extra properties values will be used signing { if (getExtraString("signing.keyId") != null) { sign(publishing.publications) } }
//https://github.com/gradle/gradle/issues/26132 val signingTasks = tasks.withType()
tasks.withType().configureEach {
mustRunAfter(signingTasks)
}
I have double verified the credentials and namespace and gpg keys. I am able to push with local host setup on the nexus repository manger local instance but same when i change the url and the username and token that i have obtained from the central.sonatype.org its failing with the 401 unauthorised code