Maven Wagon SCP is not able to establish a connection
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am trying to copy resources to another location. I am using maven wagon-ssh plugin to do this. It works fine locally, I am having issues when using Hudson/Jenkins.
Are you sure you want to continue connecting? (yes/no): The authenticity of host 'address' can't be established. RSA key fingerprint is 10:.......:bb.
but now I am getting:
Could not apply configuration for iq to wagon org.apache.maven.wagon.providers.ssh.jsch.ScpWagon:ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider' cannot be loaded org.codehaus.plexus.component.configurator.ComponentConfigurationException: ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider' cannot be loaded at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:70) at ..... Caused by: java.lang.ClassNotFoundException: org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:61) ... 37 more The authenticity of host 'address' can't be established. RSA key fingerprint is 10:.......:bb. Are you sure you want to continue connecting? (yes/no): The authenticity of host 'address' can't be established.
回答1:
Are you sure you want to continue connecting? (yes/no): The authenticity of host 'address' can't be established. RSA key fingerprint is 10:.......:bb.
Yeah this happens to us as well. You seem to have fixed your problem but I thought I'd add more details for posterity.
When running under Jenkins, there is no console so no one to confirm any new ssh keys or a changes in the keys for the maven servers. To fix this, we login to our jenkins box as the jenkins user and execute the job from the workspace directory by hand from the command line. This adds the appropriate lines to the jenkins user's ssh config files.
Typing "yes" a bunch of times seems to add the key to the known-hosts file and fix the issue although you will need to restart the job to make sure.