是否有一个 ant 库可以以类似 ant 的方式执行远程命令?
我不是在谈论 sshexec 任务,我想要一个库,它允许我使用 ant 的所有功能,但不是在本地执行操作,而是在远程主机上执行操作。
例如,使用复制、移动重命名等,但在远程主机而不是本地。
我知道 sshexec 可以实现类似的功能,但是一旦我登录到机器,我必须使用 shell,而不是我希望能够使用正常的 ant 任务。
编辑:
我刚刚发现sshsession
任务可以让你封装ant任务以远程运行,或者至少手册上是这么说的:http://ant.apache.org/manual/Tasks/sshsession.html
我已经用这个简单的 build.xml 对其进行了测试:
<project name="project" default="default">
<!-- =================================
target: default
================================= -->
<target name="default" description="description">
<sshsession host="${host}" username="${username}" password="${password}" trust="yes">
<sequential>
<mkdir dir="/tmp/sshtest"/>
</sequential>
</sshsession>
</target>
</project>
我得到了以下结果时运行它:
default:
[sshsession] Connecting to my.server
[mkdir] Created dir: C:\tmp\sshtest
BUILD SUCCESSFUL
它不是在远程服务器上创建目录,而是在我的 PC 上本地创建它。有什么想法吗?
I am not talking about sshexec task, i want a lib that will allow me to use all the power of ant but instead of doing stuff locally it will do it on a remote host.
For example using copy, move rename and more but in a remote host and not locally.
I know sshexec can acheive similar things, but once i log in to the machine i have to use shell, instead i want to be able to use normal ant tasks.
EDIT:
I have just found out about sshsession
task that lets you encapsulate ant tasks to run remotely, or at least thats what the manual says: http://ant.apache.org/manual/Tasks/sshsession.html
I have tested it with this simple build.xml:
<project name="project" default="default">
<!-- =================================
target: default
================================= -->
<target name="default" description="description">
<sshsession host="${host}" username="${username}" password="${password}" trust="yes">
<sequential>
<mkdir dir="/tmp/sshtest"/>
</sequential>
</sshsession>
</target>
</project>
I get the following result when running it:
default:
[sshsession] Connecting to my.server
[mkdir] Created dir: C:\tmp\sshtest
BUILD SUCCESSFUL
Instead of creating the dir on the remote server it creates it locally on my PC. Any idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为这完全是你所追求的,你可以尝试 AntServer / RemoteAnt< /a> 来自 ant-contrib
I don't think it's quite what you are after by you could try AntServer / RemoteAnt from ant-contrib