我想在使用 Netbeans 构建后使用 scp 将文件复制到远程服务器。
我现在手动做的是:
- 清理并构建主项目
- scp dist/project.jar login@dest/...../......
有没有办法自动化这个任务?我尝试查看 build.xml 文件,但它看起来确实是我不想弄乱的东西。
谢谢
尼古拉
我使用WinSCP来执行类似的操作。我监视本地目录的文件更改,它会自动传输更改文件。
这是可能的,请参阅 ant 网站上的 scp 任务:http: //ant.apache.org/manual/Tasks/scp.html
网站上的一个例子:
Copy a set of files to a directory
<scp todir="user:password@somehost:/home/chuck">
<fileset dir="src_dir">
<include name="**/*.java"/>
</fileset>
</scp>
<scp todir="user:password@somehost:/home/chuck">
<fileset dir="src_dir" excludes="**/*.java"/>
</scp>
您可以在构建任务中硬核密码,但这不是一个好主意。最好使用公钥。