持续观察文件变化
continuously watch files for changes
我是 Ant 的新手,我正在尝试弄清楚如何创建一个目标,让我可以使用 ant 来观察一组文件的变化,并在发生变化时 运行 特定的 ant 命令.
到目前为止我有这个
<target name="watch">
<outofdate>
<sourcefiles>
<fileset dir="${webapp.src.dir}/javascript" />
</sourcefiles>
<targetfiles />
<sequential>
<echo message="something changed" />
</sequential>
</outofdate>
</target>
我的问题是当我 运行 它 (ant watch
) 它 "succeeds" 结束退出。我希望它保持 运行ning 并等待更改,直到我杀死它。这可能吗?
您可以使用 Antelope 项目中的第三方 repeat
任务:
<taskdef resource="ise.antelope.tasks.antelope.taskdefs"
classpath="path_to_AntelopeJar"/>
...
<target name="watch">
<!-- infinite count with 1 sec interval -->
<a:repeat count="-1" interval="1">
<outofdate>
...
</outofdate>
</a:repeat>
</target>
我是 Ant 的新手,我正在尝试弄清楚如何创建一个目标,让我可以使用 ant 来观察一组文件的变化,并在发生变化时 运行 特定的 ant 命令.
到目前为止我有这个
<target name="watch">
<outofdate>
<sourcefiles>
<fileset dir="${webapp.src.dir}/javascript" />
</sourcefiles>
<targetfiles />
<sequential>
<echo message="something changed" />
</sequential>
</outofdate>
</target>
我的问题是当我 运行 它 (ant watch
) 它 "succeeds" 结束退出。我希望它保持 运行ning 并等待更改,直到我杀死它。这可能吗?
您可以使用 Antelope 项目中的第三方 repeat
任务:
<taskdef resource="ise.antelope.tasks.antelope.taskdefs"
classpath="path_to_AntelopeJar"/>
...
<target name="watch">
<!-- infinite count with 1 sec interval -->
<a:repeat count="-1" interval="1">
<outofdate>
...
</outofdate>
</a:repeat>
</target>