使用Ant<变形>选择任意日期 [英] Use Ant <modified> selector with arbitrary date

查看:321
本文介绍了使用Ant<变形>选择任意日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为内容迁移项目的一部分,我每周建设内容为一个CMS,我使用Ant脚本的内容文件复制到构建目录。到现在为止,我们已经擦CMS和重新加载整个17,000文件中设置每一次,大约需要1.5小时。但现在,内容和CMS的定制更稳定,我们希望只能上传自previous本周已修改的内容文件。

As part of a content migration project, I am building content into a CMS on a weekly basis, and I use an Ant script to copy the content files to the build directory. Up until now, we've been wiping the CMS and reloading the whole 17,000-file set every time, which takes about 1.5 hours. But now that the content and the CMS customisations are more stable, we'd like to only upload the content files that have been modified since the previous week.

我可以使用的&lt复制自从上次我跑了Ant脚本修改过的文件;选择:

I can copy files modified since the last time I ran the Ant script using the <modified> selector:

<copy todir="changed" failonerror="no">
  <fileset dir="output" includes="*.*">
    <modified/>
  </fileset>
</copy>

这工作得很好。不过,我希望能够加载上次CMS构建所发生的服务器上修改过的文件。所以我想知道是否有使用和LT的某种方式;修改&GT;的缓存为基础的方法只复制,因为像去年17.00星期四,而不是最后一次这个脚本是一个给定的日期/时间已被修改的文件运行。

Which works very nicely. However, I would like to be able to load the files that have been modified since the last CMS build that took place on the server. So I was wondering if there was some way of using <modified>'s cache-based approach to only copy the files that have been modified since a given date/time like "17.00 last Thursday" instead of "last time this script was run".

推荐答案

我得到了我的的蚂蚁邮件列表使用更新,其中斯特凡Bodewig建议在参数修改选择。当我使用Ant 1.7.1,我要工作围绕prevented其直接用作一个属性,但本质上,通过使用属性在命令行上设置设置一个bug,我可以更新缓存每当我做一个生产版本,并保持高速缓存,因为它是当我做一个中间测试版本。

I got the answer I was looking for on the Ant mailing list where Stefan Bodewig suggested using the update parameter on the modified selector. As I'm using Ant 1.7.1., I had to work around a bug that prevented its direct use as an attribute, but essentially, by setting it using a property set on the command line, I can update the cache whenever I do a production build, and leave the cache as it is when I do an intermediate test build.

下面是code我结束了(包括解决方法1.7.1):

Here is the code I ended up with (including workaround for 1.7.1.):

<copy todir="\content\Test\" includeEmptyDirs="false" failonerror="no">
  <fileset dir="../Output">
    <modified>
      <param name="update" value="false"/>
    </modified>
  </fileset>
</copy>

这篇关于使用Ant&lt;变形&GT;选择任意日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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