Ant与批处理(win环境)学习笔记(2)
在《Ant与批处理(win环境)学习笔记》中学习了Ant的一些基础知识,这期继续深入学习
——————————Ant常用task————————————————————————
1、使用classPath
<target> <javac> <classpath refid="project.class.path"/> </javac> </target>
<classpath id="project.class.path"> <pathelement path="${classpath}"/> <fileset dir="lib"> <include name="**/*.jar"/> </fileset> <pathelement location="classes"/> <dirset dir="build"> <include name="apps/**/classes"/> <exclude name="apps/**/*Test*"/> </dirset> <filelist refid="xxx"/> </classpath><condition property="isLinuxButNotRedHat"> <and> <os family="Linux"/> <not> <os family="RedHat"/> </not> </and> </condition>
<chmod perm="go-rwx" type="file"> <fileset dir="/web"> <include name="xxx"/> <exclude name="yyy"/> </fileset> </chmod>
<java classname="test.Main"> <arg value="-h"/> <classpath> <pathelement location="dist/test.jar"/> <pathelement path="/xxxx/yyy.jar"/> </classpath> </java>
<sql> driver="xxxx" url="yyy" userid="sa" password="123456"> insert into table test_table values(1,2,3); truncate table some_other_table; </sql>
<target name=default"> <antcall target="doSomethingelse"> <param name="param1" value="value"/> </antcall> <target name="doSomethingelse"> <echo message="Hello World"/> </target> </target>
<?xml version="1.0" encoding="UTF-8"?> <project> <project name="cvsroot" value=":pserver:yaoxxxx"/> <project name="basedir" value="xxx"/> <project name="cvs.password" value=":yyyy"/> <project name="cvs.passfile" value="zzzz"/> <target name="initpass"> <cvspass cvsroot="${cvsroot}" password="${cvs.password}" passfile="${cvs.passfile}"/> </target> <target name="checkout" depends="initpass"> <cvs cvsroot="${cvsroot}" command="checkout" cvsrsh="ssh" package="myproject" dese="${distdir}" passfile="${cvs.passfile}"/> </target> </project></xml>