Maven copy local file to remote server using SSH

后端 未结 6 2307
借酒劲吻你
借酒劲吻你 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:29

    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.

    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.

    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).

提交回复
热议问题