如何让 Apache 中的 Ant 在每次构建时复制文件
我在我的开发环境中使用 Eclipse 和 Ant。
我遇到了一个问题
,这是我的 build.xml 的一部分
<target name="deploy" depends="dist" description="deploy jar files">
<!-- Deploy jar files on local Tomcat -->
<echo>Deploying in ${tomcat_home}/webapps</echo>
<echo>Copying JSP files from ${build_dir} to ${tomcat_home}/${ant.project.name}/$</echo>
<copy todir="${tomcat_home}/webapps/">
<fileset dir="${resources_dir}/" includes="**/*.jsp"/>
</copy>
,我更改了一个文件,然后运行 ant 构建 - 所有文件和 jar 都被复制到我的服务器上的正确位置。
但我遇到的问题是,如果我快速进行另一个更改然后再次运行 Ant,我的文件不会被复制。显然 Any 正在查看时间戳以查看我上次更新文件的时间。如果它匹配同一分钟,则不会更新。
如何强制每次都复制文件?
谢谢
I'm using Eclipse and Ant in my development environment.
I've come across a problem
Here's part of my build.xml
<target name="deploy" depends="dist" description="deploy jar files">
<!-- Deploy jar files on local Tomcat -->
<echo>Deploying in ${tomcat_home}/webapps</echo>
<echo>Copying JSP files from ${build_dir} to ${tomcat_home}/${ant.project.name}/lt;/echo>
<copy todir="${tomcat_home}/webapps/">
<fileset dir="${resources_dir}/" includes="**/*.jsp"/>
</copy>
I change a file, then run an ant build - all the files and jars are copied to the right place on my server.
But the problem I have is, if I make another change quickly and then run Ant again, my files aren't copied. Obviously Any is looking at the timestamp to see when I last updated the file. If it matches the same minute, it doesn't update.
How can I force the file copying every time?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
overwrite="true"
强制 Ant 始终覆盖文件。但是查看手册,我还发现了关于粒度
属性:您可以尝试对此进行试验,看看是否有帮助。
You can use
overwrite="true"
to force Ant to always overwrite files. But looking at the manual, I also found this interesting tidbit regarding thegranularity
attribute:You could try experimenting with this to see if it helps.