I was trying to write a little code in my build.gradle to read an encrypted nexus password out of a file for use in uploadArchives but to make sure that it was done in such a way that, if the file couldn’t be found or there was some other error, everything else would work except for uploadArchives. So I did the following:
- Create the file with the password * Run uploadArchives – see the deployment succeed * Remove the file with the password * Run test, see that succeed * Run uploadArchives, expect failure but see success!
Looking at a little more, I realized that if I ran all of the above with --daemon, the deployment succeeded even though I was no longer supplying credentials, but if I ran without --daemon, then the credentials were being saved.
Perhaps this is as intended, but it was a little surprising to me for my deployment to succeed after I removed the credentials. I was explicitly calling
‘’’ uploadArchives {
repositories {
mavenDeployer {
repository(url: “https://xxxx/nexus/content/repositories/snapshots”) {
authentication(auth)
}
}
} } ‘’’
In one case, auth was a map containing userName and password keys. In the second case, it was null. Is there a rational explanation for this? Maybe when auth is not provided or is null, previously used credentials are tried in daemon mode? That seems surprising.