Maven copy local file to remote server using SSH

后端 未结 6 2295
借酒劲吻你
借酒劲吻你 2020-11-29 00:57

Can Maven copy local file to a remote server using SSH?

I want to specify location in maven configuration file and to copy that file (or files) to server each time

6条回答
  •  时光取名叫无心
    2020-11-29 01:26

    Although this question is not exactly new, I found myself in a similar situation today. My goal is to upload files and run commands on a remote server to which I have to tunnel (through another server). I managed to forge a solution for that with ant (which again can be triggered from maven as mentioned here).

    Ants sshsession task only creates a tunnel that you can use for the tasks within. The tasks within are not automatically run on the remote server but you can use the sshexec task together with the tunnel to achieve that. Also the scp task can now upload through the tunnel to the remote server. Here is an example:

    
        
        
            
            
            
            
        
    
    

提交回复
热议问题