使用ant直接执行shell命令

来源:互联网 发布:智慧旅游大数据平台 编辑:程序博客网 时间:2024/06/06 05:48
可以使用ant执行执行简单的shell命令,代码如下(本人亲测):
<?xml version="1.0" ?>
<project name="upload" default="scp-file">
<target name="scp-file" depends="delete">  
    <scp file="output/SSU.tar.gz" todir="test:test@10.10.96.160:/home/myuser/install" trust="true"/> 
</target>  
<target name="delete">
    <sshexec host="10.10.96.160"
  username="test
  password="test"
  command="cd install;rm *.tar.gz;ls" trust="true"/>
</target>
</project>
在上传文件之前先进行清空操作
ant版本:
E:\AntProject>echo %ant_home%
C:\apache-ant-1.9.4
0 0
原创粉丝点击