How do I prevent strict host checking in uploadArchives

At [https://docs.gradle.org/current/userguide/maven_plugin.html#uploading_to_maven_repositories] The user guide describes the DSL:

configurations {
    deployerJars
}

repositories {
    mavenCentral()
}

dependencies {
    deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}

uploadArchives {
    repositories.mavenDeployer {
        configuration = configurations.deployerJars
        repository(url: "scp://repos.mycompany.com/releases") {
            authentication(userName: "me", password: "myPassword")
        }
    }
}

However when this is executed on a slave for the first time the build seems to hang. Then using --info the following message is repeated on Jenkins.

The authenticity of host ‘host.domain’ can’t be established.
RSA key fingerprint is xx:yy:zz: etc.
Are you sure you want to continue connecting? (yes/no):

When executing the build from commandline and entering yes the build continues and the prompt never appears.

I did actually configure the ssh key using ssh-copy-id on the slave before first build and on commandline for same user I can login without password prompt.

So I need to know how to I tell the underlying ssh client to accept the server key without requiring the acceptance of prompt about key.

I don’t think there is any way to do this using Gradle with the wagon-ssh deployer.

If you switch to using SFTP instead of SCP, you could use one of Gradle’s backing transports for deployment. I’m not certain that would address your problem, but it would be in our realm to fix.
https://docs.gradle.org/current/userguide/dependency_management.html#sub:supported_transport_protocols