Code: Select all
plugins {
id 'java'
id 'maven-publish'
}
group = 'ua.com.xxxxxxxx.java'
version = '0.1.1'
repositories {
mavenCentral()
}
...
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = project.name
}
}
repositories {
maven {
name = 'OSSRH'
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = findProperty("ossrhToken") as String
password = findProperty("ossrhTokenPassword") as String
}
}
}
}
Code: Select all
Caused by: org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException: Could not PUT 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ua/com/xxxxxxx/xxxx/tools/0.1.1/tools-0.1.1.jar'. Received status code 401 from server: Content access is protected by token
Code: Select all
curl -v --upload-file test.txt -u {TOKEN_ID}:{TOKEN_PASSWORD} https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ua/com/xxx/xxx/tools/0.1.1/test.txt
< /code>
und empfangen Sie denselben Fehler: < /p>
< HTTP/1.1 401 Content access is protected by token
< /code>
Es gibt einen vollständigen Fehler: < /p>
* Host s01.oss.sonatype.org:443 was resolved.
* IPv6: (none)
* IPv4: 3.94.12.215, 52.21.62.86
* Trying 3.94.12.215:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* Connected to s01.oss.sonatype.org (3.94.12.215) port 443
* using HTTP/1.x
* Server auth using Basic with user 'gXVTvQqg'
> PUT /service/local/staging/deploy/maven2/ua/com/viburnum/hhrzc/tools/0.1.1/test.txt HTTP/1.1
> Host: s01.oss.sonatype.org
> Authorization: Basic Z1hWVHZRcWc6S0tVR2E5SXRIQTNuM3lUTE10TTQvRUpJRWltQ0xaanhBQXg3bkFiRzZIYVI=
> User-Agent: curl/8.10.1
> Accept: */*
> Content-Length: 1
>
* upload completely sent off: 1 bytes
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 401 Content access is protected by token
< Date: Sat, 08 Mar 2025 16:00:11 GMT
< Content-Length: 0
< Connection: keep-alive
< Server: Nexus/2.15.2-03
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
* Authentication problem. Ignoring this.
< WWW-Authenticate: BASIC realm="Sonatype Nexus Repository Manager"
<
* Connection #0 to host s01.oss.sonatype.org left intact