maven("<https://path/to/dependencies>") {
name = "fooBar"
credentials(PasswordCredentials::class)
}
Hello I have a password protected remote packages and trying to use
PasswordCredentials
but I only have a
password
not
username
. How do I leave
username
empty and just inject password from
gradle.properties
?
v
Vampire
06/18/2022, 9:40 PM
How does it work with just a password?
I mean with what authentication mechanism?
Afair how you wrote it, it only works with basic auth.
And basic auth needs a username and a password.
n
nuhkoca
06/19/2022, 8:07 AM
I mean username is just empty and the password is a personal access token
a
Adam S
06/19/2022, 7:45 PM
the PaswordCredentials thing is shortcut - you can get the username and password separately with
Does the username have to be empty, or can it be anything and is ignored?
If the latter, just set it to any value in the properties file.
Vampire
06/19/2022, 8:18 PM
Or you can try if it works with an empty value too
Vampire
06/19/2022, 8:20 PM
At least Gradle does not complain with an empty value for the property while it complains if the property is absent, so I'd guess it should just work
g
gildor
06/22/2022, 3:55 AM
Why not just pass empty variable, it should work. Empty username is still username for base auth
v
Vampire
06/22/2022, 7:52 AM
Isn't that what I just suggested?
I'm just not sure whether the implementation properly handles empty value, but as it does not complain I guess it does.