使用SSH将本地文件复制到远程服务器

编程入门 行业动态 更新时间:2024-10-26 18:23:32
本文介绍了使用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将本地文件复制到远程服务器

本文发布于:2023-10-17 02:51:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1499557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:本地文件   服务器   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!