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

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

问题描述

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

Can Maven copy local file to a remote 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 任务, scp 任务几乎相同,除了您可能需要添加密钥文件和密码属性(并将任务名称从 ftp 更改为 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).

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

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