2016-10-24 70 views
0

几个小时后,我试图用maven-ssh部署一个.jar文件。没有成功。下面是我的配置文件:使用maven-ssh进行部署

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>wagon-maven-plugin</artifactId> 
    <version>1.0</version> 
    <executions> 
     <execution> 
      <id>upload-jar</id> 
      <phase>deploy</phase> 
      <goals> 
       <goal>upload</goal> 
      </goals> 
      <configuration> 
       <fromFile>target/${project.build.finalName}.jar</fromFile> 
       <url>scp://172.16.11.122/foobar</url> 
       <toDir>.</toDir> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

<extensions> 
    <extension> 
     <groupId>org.apache.maven.wagon</groupId> 
     <artifactId>wagon-ssh</artifactId> 
     <version>2.10</version> 
    </extension> 
</extensions> 

<distributionManagement>   
    <repository> 
     <id>lei.intra</id> 
     <url>scp://172.16.11.122/foo</url> 
    </repository> 
</distributionManagement> 

和settings.xml中

<server> 
    <id>lei.intra</id> 
    <username>xxx</username> 
    <password>yyy</password> 
    <filePermissions>775</filePermissions> 
    <directoryPermissions>775</directoryPermissions> 
</server> 

我想我的混合旧的和新的途径。为什么我会两次指定网址(在插件的配置和distributionManagement?另外我想用jsch内部,而不是腻子的PSCP从Windows部署。

当前的错误消息是

com.jcraft.jsch.JSchException: reject HostKey: 172.16.11.122 

莫非有人请告诉我去工作和最近的例子吗?

我也试过在settings.xml中指定<privateKey>我腻子.ppk文件。PPK可能是按错键的格式,我可以把它转换?

我开启了对sshd的调试,这是输出:

debug3: fd 5 is not O_NONBLOCK 
debug1: Server will not fork when running in debugging mode. 
debug3: send_rexec_state: entering fd = 8 config len 736 
debug3: ssh_msg_send: type 0 
debug3: send_rexec_state: done 
debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8 
debug1: inetd sockets after dupping: 3, 3 
Connection from 172.16.11.1 port 22952 on 172.16.11.122 port 22 
debug1: Client protocol version 2.0; client software version JSCH-0.1.50 
debug1: no match: JSCH-0.1.50 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 
debug2: fd 3 setting O_NONBLOCK 
debug2: Network child is on pid 16885 
debug3: preauth child monitor started 
debug3: privsep user:group 110:65534 [preauth] 
debug1: permanently_set_uid: 110/65534 [preauth] 
debug3: list_hostkey_types: ssh-dss key not permitted by HostkeyAlgorithms [preauth] 
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] 
debug3: send packet: type 20 [preauth] 
debug1: SSH2_MSG_KEXINIT sent [preauth] 
debug3: receive packet: type 20 [preauth] 
debug1: SSH2_MSG_KEXINIT received [preauth] 
debug2: local server KEXINIT proposal [preauth] 
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1 [preauth] 
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] 
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth] 
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected] [preauth] 
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 [preauth] 
debug2: compression ctos: none,[email protected] [preauth] 
debug2: compression stoc: none,[email protected] [preauth] 
debug2: languages ctos: [preauth] 
debug2: languages stoc: [preauth] 
debug2: first_kex_follows 0 [preauth] 
debug2: reserved 0 [preauth] 
debug2: peer client KEXINIT proposal [preauth] 
debug2: KEX algorithms: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 [preauth] 
debug2: host key algorithms: ssh-rsa,ssh-dss [preauth] 
debug2: ciphers ctos: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc [preauth] 
debug2: ciphers stoc: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc [preauth] 
debug2: MACs ctos: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 [preauth] 
debug2: MACs stoc: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 [preauth] 
debug2: compression ctos: none [preauth] 
debug2: compression stoc: none [preauth] 
debug2: languages ctos: [preauth] 
debug2: languages stoc: [preauth] 
debug2: first_kex_follows 0 [preauth] 
debug2: reserved 0 [preauth] 
debug1: kex: algorithm: diffie-hellman-group14-sha1 [preauth] 
debug1: kex: host key algorithm: ssh-rsa [preauth] 
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none [preauth] 
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none [preauth] 
debug2: bits set: 1036/2048 [preauth] 
debug1: expecting SSH2_MSG_KEXDH_INIT [preauth] 
debug3: receive packet: type 30 [preauth] 
debug2: bits set: 1020/2048 [preauth] 
debug3: mm_key_sign entering [preauth] 
debug3: mm_request_send entering: type 6 [preauth] 
debug3: mm_request_receive entering 
debug3: monitor_read: checking request 6 
debug3: mm_answer_sign 
debug3: mm_answer_sign: hostkey proof signature 0x56370529ae80(271) 
debug3: mm_request_send entering: type 7 
debug2: monitor_read: 6 used once, disabling now 
debug3: mm_key_sign: waiting for MONITOR_ANS_SIGN [preauth] 
debug3: mm_request_receive_expect entering: type 7 [preauth] 
debug3: mm_request_receive entering [preauth] 
debug3: send packet: type 31 [preauth] 
debug3: send packet: type 21 [preauth] 
debug2: set_newkeys: mode 1 [preauth] 
debug1: rekey after 4294967296 blocks [preauth] 
debug1: SSH2_MSG_NEWKEYS sent [preauth] 
debug1: expecting SSH2_MSG_NEWKEYS [preauth] 
debug3: receive packet: type 1 [preauth] 
Received disconnect from 172.16.11.1 port 22952:3: com.jcraft.jsch.JSchException: reject HostKey: lei.intra [preauth] 
Disconnected from 172.16.11.1 port 22952 [preauth] 
debug1: do_cleanup [preauth] 
debug3: PAM: sshpam_thread_cleanup entering [preauth] 
debug1: monitor_read_log: child log fd closed 
debug3: mm_request_receive entering 
debug1: do_cleanup 
debug3: PAM: sshpam_thread_cleanup entering 
debug1: Killing privsep child 16885 
debug1: audit_event: unhandled event 12 
+0

您是否浏览过此链接http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external。 HTML?你不需要配置'wagon-maven-plugin',只需使用'wagon-ssh-external'扩展。 – Tunaki

+0

是的,我知道这个页面。这是wagon-ssh-external的一个例子。我想在没有外部程序的情况下运行它。 wagon-ssh,而不是wagon-ssh-external – ropo

+0

我试图按照这种方法:http://stackoverflow.com/questions/5819775/is-there-any-way-of-having-maven-scp-wagon-work-一致在Linux上的Mac窗口,但我得到那里的错误:当我尝试这与wagon-ssh 2.3-2.5,我得到这个异常:com.jcraft.jsch.JSchException:算法协商失败随着版本2.6-2.10我得到这个:com.jcraft.jsch.JSchException:拒绝HostKey:主机名 – ropo

回答

0

根本不需要插件wagon-maven-plugin。删除它。

我取得了一些进展:

ssh-keyscan -t rsa server_ip_address_or_hostname 

和输出增加的〜/ .ssh/known_hosts中

下一个错误我得到的是拒绝“权限”,当它试图创建从起始目录根文件夹。作为一种解决方法,我创建了一个文件夹/存储库,具有写入权限并设置了<url>scp://172.16.11.122/repository</url>