蚂蚁:如何知道是否从十复印任务至少有一个副本任务实际复制的文件 [英] Ant: How to know if at least one copy task from ten copy tasks actually copied a file

查看:231
本文介绍了蚂蚁:如何知道是否从十复印任务至少有一个副本任务实际复制的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

结果
我有哪几种副本任务的目标;它基本上复制通用罐子给我们一套应用程序从一个中央位置应用程序的 LIB 文件夹中。结果
见此,因为这是一个普通的副本任务,只有当它比目前在 LIB 文件夹一个新的罐子将被复制。结果
这是build.xml中的相关部分:


I have a target which has several copy tasks; It basically copies the common jars to our set of applications from a centralized location to the lib folder of the application.
Seeing as this is a regular copy task a jar will be copied only if it is newer than the one currently in the lib folder.
This is the relevant part in the build.xml:

<target name="libs"/>  
  <copy file=... />  
  <copy file=... />  
  <copy file=... />  
  <antcall target="clean_compiled_classes"/>  
</target>  
<target name="clean_compiled_classes" if="anyOfTheLibsWereCopied">  
  <delete .../>  
</target>

我在寻找一种方式目标设在库蚂蚁调用之前设置 anyOfTheLibsWereCopied 属性是否有任何文件实际上已经改变了。

I'm looking for a way to set the anyOfTheLibsWereCopied property before the ant call in the libs target based on whether or not any of the files has been actually changed.

谢谢,结果
以太

Thanks,
Ittai

推荐答案

我建议有一个看的 最新考量任务。我从来没有使用过它,但我猜你正在尝试做的将大致如下实施:

I would advise having a look at the Uptodate task. I have never used it before but I guess what you are trying to do will be implemented along the following lines:

<target name="libs"/>
  <uptodate property="isUpToDate">
    <srcfiles dir="${source.dir}" includes="**/*.jar"/>
    <globmapper from="${source.dir}/*.jar" to="${destination.dir}/*.jar"/>
  </uptodate>
  <!-- tasks below will only be executed if
       there were libs that needed an update -->
  <antcall target="copy_libs"/>  
  <antcall target="clean_compiled_classes"/>  
</target>

<target name="copy_libs" unless="isUpToDate">  
  <copy file=... />  
  <copy file=... />  
  <copy file=... />
</target>

<target name="clean_compiled_classes" unless="isUpToDate">  
  <delete .../>
</target>

您另一种选择将是实现自己的Ant任务,你想要做什么。这将需要更多的工作,虽然。

Your other option would be to implement your own ant task that does what you want. This would require a bit more work though.

这篇关于蚂蚁:如何知道是否从十复印任务至少有一个副本任务实际复制的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆