替代 Subversion 中的二进制文件 [英] Alternative to binaries in Subversion

查看:32
本文介绍了替代 Subversion 中的二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一些同事确信将构建工件提交到 subversion 存储库是一个好主意.争论是这样,在测试机器上安装和更新很容易 - 只需svn up"!

Some of my colleagues are convinced that committing build artefacts to the subversion repository is a good idea. The argument is that this way, installation and update on the test machines is easy - just "svn up"!

我确信有很多反对这种不良做法的论据,但我能想到的都是蹩脚的论据,例如它占用更多空间".不这样做的最好的、致命的理由是什么?我们应该采取哪些其他方法?

I'm sure there are weighty arguments against this bad practice, but all I can think of are lame ones like "it takes up more room". What are the best, killer reasons to not do this? And what other approaches should we do instead?

这适用于 Java 代码,如果这有所不同的话.一切都从 Eclipse 编译(没有自动 PDE 构建).

This is for Java code if that makes a difference. Everything is compiled from Eclipse (with no automated PDE builds).

当我说添加构建工件时,我的意思是提交看起来像这样:

When I say add the build artifacts, I mean a commit would look like this:

"Added the new Whizbang feature"

 M src/foo/bar/Foo.java
 M bin/Foo.jar

每次代码更改都有对应的生成jar文件.

Each code change has the corresponding generated jar file.

推荐答案

在我看来,代码存储库应该只包含源代码以及编译此源代码所需的第三方库(第三方库也可以通过构建过程中的一些依赖管理工具).生成的二进制文件不应与源代码一起签入.

In my opinion the code repository should only contain source code as well as third party libraries required to compile this source code (also the third party libraries might be retrieved with some dependency management tool during the build process). The resulting binaries should not get checked in along with the source code.

我认为您的情况的问题在于您没有适当的构建脚本.这就是为什么从源代码构建二进制文件涉及一些工作,例如启动 eclipse、导入项目、调整类路径等......

I think the problem in your case is that you don't have proper build scripts in place. That's why building a binary from the sources involves some work like starting up eclipse, importing the project, adjusting classpathes, etc...

如果有构建脚本,可以使用如下命令获取二进制文件:

If there are build scripts in place, getting the binaries can be done with a command like:

svn update; ant dist

我认为不将二进制文件与源代码一起检入的最重要原因是存储库的最终大小.这将导致:

I think the most important reason not to checkin the binaries along with the source is the resulting size of your repository. This will cause:

  • 更大的存储库,版本控制系统服务器上的空间可能太少
  • 版本控制系统服务器和客户端之间的大量流量
  • 更新时间更长(想象一下您从互联网上进行 SVN 更新...)

另一个原因可能是:

  • 源代码很容易进行比较,因此版本控制系统的许多功能确实有意义.但是你不能轻易地比较二进制文件......

在我看来,上述方法也引入了很多开销.开发者忘记更新对应的jar文件怎么办?

Also your approach as described above introduces a lot of overhead in my opinion. What if a developer forgets to update a corresponding jar file?

这篇关于替代 Subversion 中的二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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