Using SSH keypair to authenticate when doing uploadArchives

I’m using the “mavenDeployer” to use ssh/scp during “uploadArchives” task. Rather than code a password into the build.gradle, I’d like to rely on proper ssh setup. Specifically, I want to have the user specify their private key, and have that private key loaded in their environment (ssh-agent, ssh-add, etc). The maven repo has a shared userid, and all real users have their .pub key properly added to the “authorized_keys” file of shared userid.

Although maven/ant seem to have a “privateKey” attribute, and the Gradle DSL accepts it, it doesn’t seem to have any effect when I set it:

mavenDeployer {
                configuration = pr.configurations.publishJars
                String keyFile = System.properties["user.mavenKey"]
                repository(url: "scp://maven.company.com/path/to/maven") {
                        logger.info("Using SSH key: ${keyFile}")
                        authentication(userName: "maven", privateKey: keyFile)
                }
            }

Note: changing privateKey to privatekey causes a property error, so I know the property exists and is recognized.

I know the ssh key is working:

% ssh -i ~/.ssh/mavenKey maven@maven.company.com ls /
[ no errors, output trimmed ]

But when I run it, I get prompted for shared userid’s password:

% gradle uploadArchives
[... stuff ...]
Password for maven@evomaven.englab.juniper.net:

Note, it is NOT prompting for passphrase for the key.

It looks to me like your configuration is correct, so this could be a bug. (I don’t believe we have test coverage for this use case).

Can you please post your build output with ‘–debug’ (use GitHub Gist, please)? The log output may or may not shed some further light on the problem.