Fabian Fabian - 23 days ago 5
Android Question

Upload to private maven repo with apache maven wagon ssh | Unknown Host

I'm trying to upload my lib to private maven repo within our company.
I'm able to access the server/repo via ssh from my mac/linux terminal, but I'm not able to configure wagen-ssh (2.2) to upload it to the repo.

i wrote the gradle task as described here:
https://docs.gradle.org/current/userguide/maven_plugin.html

configurations {
deployerJars
}
dependencies {
...
deployerJars 'org.apache.maven.wagon:wagon-ssh:2.2+'
}

uploadArchives {
repositories {
mavenDeployer {
configuration = configurations.deployerJars
repository(url: "scp://{server}/var/www/maven") {
authentication(userName: "myUsername", password: "myPassword")
}
pom.version = '0.1.0'
pom.groupId = 'com.mycompany'
pom.artifactId = 'mylib'

}
}
}


But everytime i try to execute the gradle task i get the error:
Failed to deploy artifacts: Could not transfer artifact com.mycompany:mylib:aar:0.1.0 from/to remote (scp://{server}/var/www/maven): The host was not known and was not accepted by the configuration: {server}

I think wagon is using an own internal ssh client. How can i tell this client to accept my host, or accept any host?!
Or am I wrong and there is another problem?

Answer

Ok i found the solution myself: the entry in the known_hosts file for my server was with

ecdsa-sha2-nistp256

but the ssh client of wagon only understands rsa. So

ssh -o HostKeyAlgorithms=ssh-rsa-cert-v01@openssh.com,ssh-rsa {yourhost}

does the magic.