当您的 ant 构建过程在您的版本控制上出现问题时该怎么办 [英] What to do when your ant build process craps on your Version Control

查看:22
本文介绍了当您的 ant 构建过程在您的版本控制上出现问题时该怎么办的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个不错的 Java 项目,使用 Ant 构建到/dist 文件夹.
整个项目都在版本控制之下,所以我可以在 dist 文件夹的路径上通过 'svn export' 部署最新版本.
但是我的构建不断删除我的 dist 文件夹中的 .svn 文件夹及其所有依赖项,因为它在构建时清除了文件夹,而不仅仅是覆盖.确切的罪魁祸首是 JarBundler,它是构建我的 mac.app 包的 Ant 任务 - 它在重新创建之前删除了整个包的文件夹.
这显然搞砸了我的 svn,因为该文件夹现在缺少所有 .svn 文件夹,所以它说它有冲突.

So I've got a nice Java project, build with Ant to a /dist folder.
The whole project is under version control, so I can deploy the latest version just by 'svn export' on the path to the dist folder.
But my build keeps deleting the .svn folders inside my dist folder, and all its dependents, because it cleans out the folder when building instead of just overwriting. The precise culprit is JarBundler, the Ant task that builds my mac.app bundle - It deletes the whole bundle's folder before recreating it.
This obviously craps up my svn, because all the .svn folders are now missing for that folder and so it says its in conflict.

有人对我如何解决这个问题有任何想法吗?我不知道如何阻止 jarbundler 删除所有内容,所以我将不得不做一些我害怕的更棘手的事情.我也是 Ant 新手,仅供参考.

Anyone have any ideas for how I could solve this? I can't figure out how to stop jarbundler from deleting everything, so im going to have to do something more hacky I fear. Im pretty new to Ant as well, just for reference.

推荐答案

如果您希望您的源代码管理系统成为 对所有人的唯一参考:

To have dist in source control can be considered as good practice if you want your source control system to be a unique referential for all:

  • 开发人员
  • 汇编程序(单元测试)
  • 认证测试人员(您在集成平台上查询一堆 dist 并在那里执行您的非回归测试、性能测试、压力测试等)
  • 生产发布经理...

但是你需要有一个适当的发布过程来完成这个.

BUT you need to have a proper release process to pull this through.

在您的情况下,build 必须位于单独的私有目录中,该目录不在 subversion 中.当构建没问题时,如果它是官方版本,你导入到 subversion,或者你将它导入共享目录,如果它是一个临时构建,只是下一个团队需要的(因此避免将数百个构建提交到 SCM,不使用空间).

In your case, the build must be in a separate and private directory, that is a directory not in subversion. When the build is ok, you import it into subversion if it is an official release, or you import it to a shared directory if it is a temporary build, just needed by the next team (thus avoiding to commit hundreds of builds into SCM, using space for nothing).

注意:在您的 SCM 中包含交付 (dist) 的主要优势是允许依赖项目不与您的源一起工作,而是直接与您的交付一起工作(这肯定会在某一时刻投入生产):如果他们设法使他们的代码工作,通过与您的交付一起编译,那么他们自己的 dist 很可能在与您一起部署时会工作.
这样,其他团队可以在访问任何来源时访问您的交付(您的myProject.jar"):他们可以通过 SCM 读取您的 jar 版本、日期、历史、元数据、标签和以此类推.

Note: the main advantage for having the delivery (dist) in your SCM is to allow dependent project to work not with your sources, but directly with your delivery (which is bound to go at one point or another into production): if they manage to make their code work, by compiling with your delivery, chances are their own dist, when deployed with your, will work.
That way, the other teams access your delivery (your 'myProject.jar') as they access any of their sources: they can read through the SCM the version of your jar, its date, its history, its metadata, its label, and so on.

然而,对于一个小型单体(如没有其他项目依赖它")项目,可以说 dist(最终打包交付)可以按需重建并存储在外部引用系统,例如作为外部 Maven 存储库.
但是:Maven 不是 SCM 存储库,这意味着您需要对 jar ('MyProject-1.0.jar') 进行签名,您没有历史记录,并且您需要在交付时在单独的文本文件中报告所有元数据.在该 Maven 存储库中访问该交付的任何其他项目都需要根据您的版本命名约定调整其脚本和类路径.
另外,Maven 是开发架构中的另一个存储库.只要您可以将回购数量保持在最低限度(1";)),那就更好了.

However, for one small monolithic (as in 'no other projects depend on it') project, it can be argued that dist (the final packaged delivery) could be re-build on demand and stored in an external referential system, as an external Maven repository for instance.
BUT: Maven is no SCM repository, meaning you need to sign you jar ('MyProject-1.0.jar'), you have no history, and you need to report all your metadata on a separate text file along your delivery. Any other project accessing to that delivery in that Maven repo needs to adjust its scripts and classpaths accordingly to your version naming convention.
Plus, Maven is another repository in your development architecture. Whenever you can keep the number of repos to a minimum (of '1' ;) ), it is better.

这篇关于当您的 ant 构建过程在您的版本控制上出现问题时该怎么办的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆