使用SSH将本地文件复制到远程服务器 [英] Maven copy local file to remote server using SSH

查看:1142
本文介绍了使用SSH将本地文件复制到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven可以使用SSH将本地文件复制到远程服务器服务器吗?

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

我想在maven配置文件中指定位置,并在每次执行部署阶段时将该文件(或文件)复制到服务器。

I want to specify location in maven configuration file and to copy that file(or files) to server each time deploy phase is executed.

推荐答案

maven-deploy-plugin允许您配置部署阶段以使用scp部署到服务器。 文档中有一个页面它描述了如何完成。

The maven-deploy-plugin allows you to configure the deploy phase to deploy to a server using scp. There is a page in the documentation that describes how it can be done.

我相信这将取代正常的部署,而不是添加到它,所以它可能不是你以后。

I believe this will replace the normal deployment instead of add to it, so it may not be what you're after.

如果您需要部署到传统的Maven存储库以及将文件传递到远程服务器,则需要使用其他答案建议的scp任务。

If you need to deploy to a traditional Maven repository as well as deliver the file to the remote server, you will need to use the scp task as the other answers suggest.

此答案我已经描述了如何配置ftp任务,除了您可能需要添加密钥文件和密码属性(并将任务名称从ftp更改为scp)之外,scp任务几乎相同。

In this answer I've described how to configure the ftp task, the scp task is almost identical except you may need to add the keyfile and passphrase attributes (and change the task name from ftp to scp obviously).

这篇关于使用SSH将本地文件复制到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆