ant使用整理



一段可以使用的配置,这里包括编译,打包,和linux链接,scp

  1. <project name="client" default="sshexec" basedir=".">  
  2.     <property name="product" value="DM_woyo"/>  
  3.     <property name="version" value="1.0"/>  
  4.     <property name="src.dir" value="${basedir}/src"/>  
  5.     <property name="build.dir" value="${basedir}/build"/>  
  6.     <property name="lib.dir" value="${basedir}/lib"/>  
  7.     <property name="jar.file" value="${product}.${version}.jar"/>  
  8.     <property name="sshServerIP" value="192.168.1.140"/>  
  9.     <property name="user" value="root"/>  
  10.     <property name="passw" value="master"/>  
  11.     <path id="classpath">  
  12.         <fileset dir="${lib.dir}">  
  13.             <include name="**/*.jar"/>  
  14.         </fileset>  
  15.     </path>  
  16.   
  17.     <target name="clean">  
  18.         <echo>clean build dir</echo>  
  19.         <delete dir="${build.dir}" quiet="true"/>  
  20.         <delete file="${lib.dir}/${jar.file}" quiet="true"/>  
  21.     </target>  
  22.   
  23.     <target name="init" depends="clean">  
  24.         <mkdir dir="${build.dir}"/>  
  25.     </target>  
  26.   
  27.     <target name="compile" depends="init">  
  28.         <echo>compile the source</echo>  
  29.         <javac srcdir="${src.dir}" destdir="${build.dir}">  
  30.             <include name="**/*.java"/>  
  31.             <classpath refid="classpath"/>  
  32.         </javac>  
  33.     </target>  
  34.   
  35.     <target name="jar" depends="compile">  
  36.         <jar destfile="${lib.dir}/${jar.file}">  
  37.             <fileset dir="${build.dir}">  
  38.                 <include name="**/*.class"/>  
  39.             </fileset>  
  40.         </jar>  
  41.     </target>  
  42.   
  43.     <target name="run" depends="jar">  
  44.         <java jar="${lib.dir}/${jar.file}" fork="yes">  
  45.         </java>  
  46.     </target>  
  47.     
  48.     
  49.     <target name="sshexec" depends="run" >
  50.           <echo>clean the jar files on ${sshServerIP}</echo>    
  51.           <sshexec host="${sshServerIP}" username="${user}"  password="${passw}" trust="true" command="rm -rf /opt/dataming/lib/*.jar   "/>
  52.           <echo>copy  local  jar files to  ${sshServerIP}</echo>    
  53.           <scp todir="${user}:${passw}@${sshServerIP}:/opt/dataming/lib" trust="true">
  54.                  <fileset dir="${lib.dir}">  
  55.                     <include name="**/*.jar"/>  
  56.                 </fileset>  
  57.           </scp>
  58.           <!--echo>start the DM server .....</echo>     
  59.           <sshexec host="${sshServerIP}" username="${user}"  password="${passw}" trust="true" command="rm -rf /opt/dataming/lib/*.jar   "/-->
  60.     </target>
  61.     
  62.     
  63.     
  64. </project>  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值