ANT的一些操作
来源:互联网 发布:mac系统pdf转换成word 编辑:程序博客网 时间:2024/05/16 12:14
1重命名
<rename dest="ant-${version}.jar" src="foo.jar" />
2修改文件时间,也可以判断文件是否存在
<touch file="build.xml" datetime="06/06/2000 2:02 pm"></touch>
3条件语句
<?xml version="1.0"?><project name="filemanager" default="outputXML"><target name="outputXML"><condition property="ifexist"><istrue value="true"/></condition><antcall target="istrue"></antcall><antcall target="isfalse"></antcall></target><target name="istrue" if="ifexist"><echo>${ifexist}</echo></target><target name="isfalse" unless="ifexist"><echo>${ifexist}</echo></target></project>
4condition
istrue isfalse:断言 真 假
<target name="test"> <condition property="scondition"> <istrue value="true"/> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target>
not 逻辑非
<target name="test"> <condition property="scondition"> <not> <istrue value="true"/> </not> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target>
and 逻辑与
<target name="test"> <condition property="scondition"> <and> <istrue value="true"/> <istrue value="false"/> </and> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target>
available 是否可用
<path id="all.test.classes"> <pathelement location="bin"/> </path> <target name="test"> <condition property="scondition"> <!--在指定的classpath路径下是否存在资源 TestTest.class--> <available resource="TestTest.class"> <classpath refid="all.test.classes" /> </available> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target>
isset 指定属性是否存在
<project name="testCondition" default="test"> <!--属性也可以通过ant参数-D来设置--> <property name="name" value="this is name"/> <target name="test"> <condition property="scondition"> <!--如果属性name不存在则返回false--> <isset property="name"/> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target> </project>
equals 是否相等
<project name="testCondition"> <!--属性也可以通过ant参数-D来设置--> <property name="name" value="this is name"/> <target name="test"> <condition property="scondition"> <!--如果arg1的值与arg2的值相等返回true,否则为false--> <equals arg1="${name}" arg2="this is name"/> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target> </project>
filesmatch 比较文件
<project name="testCondition"> <target name="test"> <condition property="scondition"> <!--如果file1所代表的文件与file2所代表的文件相等返回true,否则为false--> <filesmatch file1="testfile1.txt" file2="testfile2.txt"/> </condition> <antcall target="isTrue"></antcall> <antcall target="isFalse"></antcall> </target> <target name="isTrue" if="scondition"> <echo>is ture</echo> </target> <target name="isFalse" unless="scondition"> <echo>is false</echo> </target> </project>
0 0
- ANT的一些操作
- ant的一些技巧!
- ant的一些知识
- ANT的一些用法
- Ant的一些知识
- Ant 的操作
- 常用ant的操作
- ant的一些偏门技巧
- ant的一些偏门技巧
- ant脚本的一些总结
- ant脚本的一些使用
- 常用的ant的操作
- 常用的ant的操作
- 常用的ant的操作
- ant的mybaties生成操作
- ant的文件相关操作
- CentOS6+ANT编译环境_和ant的一些属性
- ClassLoader与Ant的一些问题
- 如果你也面试04 C++虚继承的概念
- Android自定义系列(1)——自定义view 仿微信viewPage底部显示图标(整理来自慕课网)
- ubuntu怎么修改设备名称
- Animation基本功能的实现
- JDK1.6和JDK1.7共存和Eclipse出错
- ANT的一些操作
- lua学习笔记 0 android嵌入Lua
- 在线裁剪图片
- 如果你也面试05 C++中虚函数的作用是什么?它应该怎么用呢?
- Android系统内核cpufreq技术分析
- android动态添加删除布局,并且带有动画效果,点击可以展开布局
- opengl(三)
- android:layout_gravity和android:gravity的区别
- @synthesize和@dynamic区别