使用 svnant 更新 build.xml 文件所在的目录是否安全?
我正在维护一个构建系统,该系统使用一个目录中的 svnant 来更新另一个目录中的大量项目。然后它会转移到已更新的项目之一,并进行实际的构建。
完成该主要项目中的所有操作是否安全?主项目是否可以使用 svnant 来更新自身,或者如果 svn 需要更新 ant 当前使用的 build.xml 文件,是否会出现问题?
I'm maintaining a build system that uses svnant from a one directory to update a large number of projects in another directory. It then moves to one of those projects that's been updated, and does the actual build.
Is it safe to do everything from that main project? Can the main project use svnant to update itself, or could there be a problem if svn needs to update the build.xml file that ant is currently using?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于自我更新的主项目 build.xml - 您可能在一次性运行 subversion 更新和构建时遇到问题。问题的性质取决于对 build.xml 所做的具体更改。只需重新运行构建就可能修复它,因为启动时加载的 build.xml Ant 将会是最新的。
如果您确实必须可靠地更新 build.xml 并一次性执行构建,您可能会考虑将构建的 post-svnant 部分包装在
antcall
任务。当 Ant 运行 antcall 的目标时,它会重新读取 build.xml,因此自调用 Ant 以来对该文件所做的任何更改都会被考虑在内。 Antcall 从头开始处理,因此如果您进行了(可能昂贵的)初始化,则需要再次运行这些初始化。For the self-updated main project build.xml - you might have a problem with running the subversion update and build in one go. The nature of the problem depends on exactly what change is made to the build.xml. Simply rerunning the build would probably fix it, as the build.xml Ant then loads at start up would be up-to-date.
If you really have to reliably update build.xml and carry out a build in one go, you might consider wrapping the post-svnant part of the build in an
antcall
task. When Ant runs the antcall'ed target, it re-reads the build.xml, so any change to that file since Ant was invoked is taken in to account. Antcall starts processing from scratch, so if you have (possibly expensive) initialisations these would need to be run again.如果这不会占用太多磁盘空间(如果磁盘空间不是问题),您可以有两个工作目录:
svnant
”您想要的任何内容,换句话说,您将在启动任何构建之前拉修改。
If that doesn't take too much disk space (of if disk space is not an issue), you could have two working directories:
svnant
' anything you wantIn other word, you would pull the modifications before launching any build.