mac下ant的使用,以及使用ant上传工程和使用ant远程执行shell
首先对mac下的ant进先升级,如果mac下没有安装ant下载解压就可以了。
1.下载最新的ant,下载地址:http://ant.apache.org/bindownload.cgi,可以在这里找到最新的下载地址,
我目前下载的是
apache-ant-1.9.0-bin.tar.gz
jsch-0.1.49.jar
jsch-0.1.49.zip包copy到ant/lib目录下面,这里不要删除原来的ant-jsch.jar这个包,删除后会有错误
eclipse-->preferences在左边就可以找到ant,然后点击进入runtime,在右边可以
project1.dir=/Users/alecyan/Documents/project1project12.dir=/Users/alecyan/Documents/project2
<?xml version="1.0" encoding="UTF-8"?><project name="uploadProjectByAnt" basedir="." default="upload"><property file="build.properties" /> <target name="upload" description="Generate the distribution"> <antcall target="uploadProject1" /><antcall target="uploadProject2" /> </target><target name="uploadProject1"> <scp todir="username:password@192.168.1.111:/tmp/alecyan/project1" trust="true"><fileset dir="${project1.dir}"> <exclude name="**/bin/**"/> <exclude name="**/build/**"/> </fileset> </scp> </target> <target name="uploadProject2"> <scp todir="username:password@192.168.1.111:/tmp/alecyan/project2" trust="true"> <fileset dir="${project2.dir}"> <exclude name="**/bin/**"/> <exclude name="**/build/**"/> </fileset> </scp> </target></project>
**/**的形式,比如要上面的要排除build文件夹,要写成
**/build/**.
<?xml version="1.0" encoding="UTF-8"?><project name="TestAnt" basedir="." default="sshexec"><target name="sshexec"><sshexec host="192.168.1.222" username="username" password="password" command="cd /tmp/;mkdir dir;ls -l;" trust="true"/></target></project>