https://kotlinlang.org logo
Title
p

Piotr Krzemiński

04/04/2023, 6:28 PM
I'm struggling to use gradle-nexus/publish-plugin to publish my library to Maven. I'm facing this issue: https://github.com/gradle-nexus/publish-plugin/issues/118. It was working fine until I decided to change groupId, then despite setting new hostnames for Sonatype, I'm getting this 401. Anyone faced a similar problem?
j

Javier

04/04/2023, 7:12 PM
Maybe you have to recreate the token or something so?
p

Piotr Krzemiński

04/04/2023, 7:47 PM
I don't use any token, just a regular username/password pair. They worked fine so far and they still work with Nexus UI
j

Javier

04/04/2023, 8:43 PM
you should user nexus name and token instead, if there is a leak you can reset them
anyway I am not sure then why it can be failing if all data is correct as I am using the old nexus endpoint
p

Piotr Krzemiński

04/05/2023, 8:21 AM
It works! What I needed to change to make it work locally: the env vars should be pascalCase in the second part, e.g. ORG_GRADLE_PROJECT_sonatypePassword and previously I was using ORG_GRADLE_PROJECT_SONATYPEPASSWORD. On CI, however, I was using correct env var names all the time, and I stored values of secrets again. Maybe during moving the repo from my personal GitHub user to the organization, something broke
v

Vampire

04/05/2023, 8:57 AM
Actually PascalCase a.k.a. UpperCamelCase has an upper first character, opposed to camelCase. 😉 They don't need to be camelCase, they simply need to be exactly like you refer to them in th build script. 🙂
p

Piotr Krzemiński

04/05/2023, 8:57 AM
sorry, I always mix the two! I don’t refer to them directly, it’s a convention used by Gradle, see https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties
v

Vampire

04/05/2023, 9:07 AM
You are just setting a project property with that syntax. With the former you did set a project property named
SONATYPEPASSWORD
that you could also get in the build script. It is just that you (in this case transitively, because it is the Nexus Publishing plugin) request
sonatypePassword
, not
SONATYPEPASSWORD
. :-)
p

Piotr Krzemiński

04/05/2023, 9:08 AM
yes, that’s right