我如何在 ant 中等待文件可用?
我正在尝试修复一个构建文件,其中一部分运行 bash 脚本来生成文件。这个文件的生成只需要不到一秒的时间,直到我们转向 Eclipse 之前这并不是一个问题。
问题是,如果我在 Eclipse 中保存任何文件并进行更改,然后运行 ant 进行构建。我在生成的文件上收到“未找到类”错误。似乎 Eclipse 正在对新生成的文件执行某些操作(它甚至显示错误复选框)
如果我再等待几秒钟并再次运行构建,它就可以正常工作。
我一直在尝试使用的是这个。
<waitfor maxwait="30" maxwaitunit="second">
<available file="${src}/thefile.java"/>
</waitfor>
它不起作用。我还尝试查看名为
的内容 在选择器集下,根据文档可以将其与其他一些 waitfor 方法结合使用。
我该如何解决这个问题或者有其他方法解决它吗?
I'm trying to fix a build file where a part of it runs a bash script to generate a file. This file generation takes under a second and wasn't a problem until we moved to eclipse.
The issue is that if I save any file in eclipse with a change and then run ant to build. I get a "class not found" error on the generated file. Seems like eclipse is doing something to the newly generated file (it even shows it with an error check box)
If I wait a few seconds more and run the build again, it works fine.
What I have been trying to use is this.
<waitfor maxwait="30" maxwaitunit="second">
<available file="${src}/thefile.java"/>
</waitfor>
It does not work. I also tried to look at something called <readable>
under the selectors set which by the documentation could be used in junction with some other waitfor methods.
How can I fix this problem or is there another way around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题了。 Eclipse 在构建工作区时锁定了生成的文件,因此生成它的 bash 脚本会混乱。
工作区的构建花了 4-5 秒,所以这就是延迟。
通过禁用 XML 和 DTD 验证,我能够加快工作区的构建速度。 (窗口 > 首选项 > 验证)
Found the issue. Eclipse was locking the generated file while it was building the workspace so the bash script that generated it would mess up.
The building of the workspace took 4-5 seconds so that was the delay.
I was able to speed up the building of the workspace by disabling the XML and DTD validation. (Window > Preferences > Validation)