Ant中如何不增加build.number?
我的 build.xml 中有很多 Ant 目标。一般来说,我通过 shell 脚本运行两个,一个用于构建应用程序,另一个用于清理。 shell 脚本检查构造的退出状态,看看它是否应该清理或留下混乱,以便我可以确定出了什么问题并修复它。
所以一切都很顺利,大多数时候,Ant 执行一次用于构建,一次用于清理。这会导致每次执行时我的 build.number 都会增加。所以在稳定状态下,我的 build.number 增加了 2。
如何告诉 Ant 不增加 build.number?我会这样做是为了清理,因为我还没有建造任何东西。
我知道创建一个单独的脚本仅用于清理的明显答案,但我宁愿将整个 build.xml 保留在一个文件中。
I have many targets in my build.xml for Ant. Generally I am running two via a shell script, one to construct the application and one for cleaning up. The shell script checks the exit status of the construction to see if it should clean up or leave the clutter behind so I can determine what went wrong and fix it.
So went all is going well, the majority of the time, Ant is executed once for construction and once for clean up. This results in my build.number being incremented for each execution. So in steady state, my build.number increments by 2.
How can a tell Ant to not increment the build.number? I would do this for clean up as I haven't built anything.
I know the obvious answer of creating a separate script for clean up only, but I'd rather keep the entire build.xml in one file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不将一个目标(完整的)构建定义为依赖于编译目标和清理目标?这样,Ant 只需执行一次,如果它退出,就不会执行
cleanup
任务。Why not define one target (the complete) build as being dependent on a
compilation
target and acleanup
target ? That way Ant only has to execute once, and if it bails out it won't execute thecleanup
task.