我对 ANT 及其工作非常陌生,所以如果这个问题太原始了,请原谅我:)。
背景:
我在 Windows Server 中设置了 TOMCAT 和 ANT。
我必须在多个远程目标操作系统 - AIX/HP/SUSE 中构建项目。
因此,我创建了一组插件(具有 ANT 代码的 .xml 文件)并按顺序执行以获得最终的构建包。
问题描述:
在构建执行的过程中,我需要在远程机器(即AIX/HP/SUSE)服务器中执行一些任务,然后根据结果,需要采取行动。
例如 -
- 基于远程服务器空间可用性 - 在预设中将构建标记为失败。
- 检查是否有任何在 DOS 模式下传输的文件,并将构建标记为失败。等
这些大部分将用 shell 脚本编写(可以在所有 3 个操作系统中运行) - 将返回 1 表示失败,0 表示成功。
问题:
I am very new to ANT and its working, so spare me if this question is too primitive :).
Background :
I have my TOMCAT and ANT set-up in my Windows Server.
I will have to build project in multiple remote target OS - AIX/HP/SUSE.
So I have created a set of plugins (.xml files having ANT code) and execute in sequence to attain the final build package.
Problem Description :
In the process of build execution, I need to execute some task in the remote machine (i.e AIX/HP/SUSE) servers and then based on the result, need to take action.
Like for example -
- Based on remote server space availability - flag the build as failure in the presetup.
- Check if there are any files transferred in DOS mode and flag the build as failure.. etc
These mostly will be written in shell scripts (which can be run in all 3 OS) -will return 1 for failure and 0 for success.
Question :
-
How to execute "commands" in remote machine and capture the result from the Windows server using ANT? I know we can use telnet/write/read ANT commands for remote execution - but how to capture the result - like say output from shell script.
-
Or to be better, is there a way to execute the ANT plugin (xml) file remotely and capture the build failure/success result? Like ant -f <remoteMachine
> <passwd
> <path
> <file
>
发布评论
评论(1)
建议您考虑使用 Ant
sshexec
任务。您可能需要获取 Ant 外部 JSch 库 才能使用它,除非您已经有了。 sshexec 任务可以设置为在远程命令失败时失败,您也可以将远程命令的输出捕获到属性中。另外,由于您是 Ant 新手,我建议您浏览 Ant 任务概述 以获取了解 Ant 的能力。
Suggest you consider using the Ant
sshexec
task. You'll probably need to get the Ant-external JSch library to use it, unless you already have it. Thesshexec
task can be set up to fail when the remote command fails, also you can capture the output from the remote command to a property.Also, as you're new to Ant I suggest you browse the Ant tasks overview to get a feel for what Ant can do.