在Ant中如何选择性的执行task,请各位高人指点:) 比如,如果property selectTask1的值为true时执行task1,当selectTask1的值为false时执行task2,不知道ant是否支持这样的功能,感谢各位高人指点:) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用target比如说,你需要2个任务 分别是task1 task2<project name="AspectGamingCore" default="task-all"> <!--就是如果你在CMD里面直接打ant 就执行task-all --> <target name="task-all"> <antcall target="task1"/> <antcall target="task2"/> </target> <target name="task1"> <property name="xxxxx" value="xxxxxxxx"/> <property name="xxxxxx" value="xxxxxxxxx"/> <antcall target="build"/> <!--比如你task1任务需要完成build --> <antcall target="configure"/> <!--比如你task1任务需要完成configure--> </target><target name="task2"> <property name="xxxxx" value="xxxxxxxx"/> <property name="xxxxxx" value="xxxxxxxxx"/> <antcall target="build"/> <!--比如你task1任务需要完成build --> <antcall target="configure"/> <!--比如你task1任务需要完成configure--> </target> <target name="build"> <!-- 这里写build里面需要做点什么东西 --></target> <target name="configure"> <!-- 这里写configure里面需要做点什么东西 --></target></project>如果你需要执行task1 and task2 就这样 ant 或者 ant task-all如果要执行task1 执行ant task1如果要执行task2 执行ant task2 Ant 控制流程!你搜索下就很多。 <target name="xxx"> <if> <equals arg1="${xx.xx}" arg2="true"> <then> <ant target="xxx"> </then> <else> <ant target="xxx"> </else> </if></target>好像是这么写,忘光了 用 ant的 判断标签,值用一个.peoperties保存你的选项。 这个就是啊<target name="task1"> <property name="xxxxx" value="xxxxxxxx"/> <property name="xxxxxx" value="xxxxxxxxx"/> <antcall target="build"/> <!--比如你task1任务需要完成build --> <antcall target="configure"/> <!--比如你task1任务需要完成configure--> </target>把antcall加到target里面 求教htm文件转化成JSP文件出现乱码问题 tomcat启动SSH项目的时候卡住了 给个CVS教程吧 Spring + Struts的项目发布到Tomcat出错 weblogic下如何不重启调试STRUTS hibernate 持久化对象的一对多检索策略问题 100分! struts里配置Validator的问题 一个xml的解析问题用SAX方法(急!!!!!!!!!!!!!!!!!!!!11) 提问。 急问高手:java中如何调用linux系统命令?? [☆★☆★☆★☆★]互斥机制方案[☆★☆★☆★☆★] 现在公司做手机oa,比较闲,想搞点j2ee的兼职,有美工,哪里接业务?
<!--就是如果你在CMD里面直接打ant 就执行task-all --> <target name="task-all">
<antcall target="task1"/>
<antcall target="task2"/>
</target> <target name="task1">
<property name="xxxxx" value="xxxxxxxx"/>
<property name="xxxxxx" value="xxxxxxxxx"/>
<antcall target="build"/> <!--比如你task1任务需要完成build -->
<antcall target="configure"/> <!--比如你task1任务需要完成configure-->
</target><target name="task2">
<property name="xxxxx" value="xxxxxxxx"/>
<property name="xxxxxx" value="xxxxxxxxx"/>
<antcall target="build"/> <!--比如你task1任务需要完成build -->
<antcall target="configure"/> <!--比如你task1任务需要完成configure-->
</target> <target name="build">
<!-- 这里写build里面需要做点什么东西 -->
</target> <target name="configure">
<!-- 这里写configure里面需要做点什么东西 -->
</target>
</project>如果你需要执行task1 and task2 就这样 ant 或者 ant task-all
如果要执行task1 执行ant task1
如果要执行task2 执行ant task2
<target name="xxx">
<if>
<equals arg1="${xx.xx}" arg2="true">
<then>
<ant target="xxx">
</then>
<else>
<ant target="xxx">
</else>
</if>
</target>
好像是这么写,忘光了
用 ant的 判断标签,值用一个.peoperties保存你的选项。
<property name="xxxxx" value="xxxxxxxx"/>
<property name="xxxxxx" value="xxxxxxxxx"/>
<antcall target="build"/> <!--比如你task1任务需要完成build -->
<antcall target="configure"/> <!--比如你task1任务需要完成configure-->
</target>把antcall加到target里面