Subversion和依赖关系 [英] Subversion and dependencies

查看:165
本文介绍了Subversion和依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一个可行的策略来解决以下问题。

I am trying to find a viable strategy to a following problem.

我们有几个依赖于我们框架的Web项目。一切存储在我们的SVN中,并拥有自己的项目,其中包含所有必要的目录结构(trunk,tags,branches)。在一个例子中 - 我们有webprj01和webprj02项目,我们有一个框架frm01。所有这些都有通常的SVN项目结构 - 中继线,标签,分支。

We have several web projects which are dependent on our framework. Everything is stored in our SVN and has its own project with all the necessary directory structure (trunk, tags, branches). In an example - we have projects webprj01 and webprj02 and we have a framework frm01. All of those have usual SVN project structure - trunk, tags, branches.

webprj01和webprj01都依赖于frm01,在现实生活中frm01作为webprj01的子目录存在, webprj02。为了在SVN中实现这一点,可以设置svn:external属性,我们可以将frm01设置为指向webprj01和webprj02的trunk中的/ frm01 / trunk。

webprj01 and webprj01 are both dependent on frm01 and in real life frm01 is present as subdirectory of webprj01 and webprj02. To achieve this in SVN it is possible to set svn:external property and we can set frm01 to point to /frm01/trunk inside trunk of webprj01 and webprj02.

要做一个现实生活中的编码,我们必须将所有三个项目作为工作副本签出,并在自己的工作副本中对特定代码库进行更改。没有办法将更改从webprj01 / frm01发布到SVN。更改需要在frm01工作副本中完成,并通过SVN传输到webprj01 / frm01和webprj02 / frm01工作副本。

To do a real life coding we have to have all three projects checked out as a working copy and do the changes to particular codebase in it's own working copy. There is no way to publish changes from webprj01/frm01 to the SVN. The change needs to be done in frm01 working copy and transfered through SVN to webprj01/frm01 and webprj02/frm01 working copies.

此解决方案在分支时具有依赖关系的问题。我从SVN / webprj01 / trunk到/webprj01/branches/release-1.0.0生产分支。在工作第二个项目webprj02和frm01的两天中,我不再能够通过分支版本1.0.0中的svn:externals进行稳定的检出。目录frm01已经指向frm01 / trunk的新更改。

This solution has a problem with dependencies while branching. I make a production branche from SVN /webprj01/trunk to /webprj01/branches/release-1.0.0. In two days while working on second project webprj02 and frm01 I am no longer able to have stable checkout as through svn:externals in branch release-1.0.0. directory frm01 already points to new changes of frm01/trunk.

描述只是一个简化版本的问题。在我们现实生活中的情况下,依赖关系往往会深入五层。我希望能够随时从SVN获取稳定的代码。用不同的话说当我将webprj01分支/标记为release-1.0.0。我想从创建的一年中获得该特定标签的稳定代码。

Described is just a simplified version of the problem. In our real life situations the dependencies go sometimes five levels deep. I'd like to be able to obtain stable code from SVN at any time. In different words. When I branched/tagged webprj01 as release-1.0.0. I want to get stable code for that particular tag in a year from creation.

很明显,使用svn:externals描述的策略没有做到这一点。你对这种情况有什么看法?没有必要使用一个结帐。即使使用构建脚本或其他解决方案也可以帮助您。我正在寻找一个长期的解决方案,这不会很大程度上依赖于人类的行为,因为我们容易犯错误。

It is obvious, that described strategy using svn:externals does not do the work. What would be your experience with this situation? It is not necessary to use one checkout. Even using of build scripts or other solution would be of help here. I am looking for a long time solution to the issue which would not depend heavily on human actions as we are prone to mistakes.

推荐答案

在Java世界中,我不会尝试仅使用版本控制系统来解决这个问题 - 而是使用像Maven +版本控制系统这样的依赖管理工具。

In the Java world, I would not try to solve this using only a version control system - I would instead use a dependency management tool like Maven + a version control system.

在我工作的地方,我们有一个看起来很常见的设置:

At the place where I work, we have a set-up which seems pretty common:

任何框架项目都生活在自己的目录结构中(trunk,tags,分支)像你似乎已经有了。这些也使用Maven进行管理,并且每当有东西被签入时,组件的新版本(在大多数情况下是JAR文件)被发布到我们的本地Maven仓库(驻留在Nexus服务器上)。

Any "framework" project lives in it's own directory structure (trunk, tags, branches) like you already seem to have. These are also managed using Maven and whenever something is checked in, a new version of the component (in most cases a JAR-file) is published to our local Maven repositry (which resides on a Nexus server).

任何需要使用框架项目的项目都将依赖于特定版本的框架项目,然后,Maven将在构建项目时自动从Nexus服务器中提取此版本。

Any project which needs to use the "framework" project will have a dependency towards a specific version of the framework project - Maven then automatically pulls this version from the Nexus server whenever the project is being built.

这使我们能够分别发布每个项目和框架组件,但仍然跟踪它们之间的依赖关系。我们甚至可以拥有不同项目使用的多个版本的框架组件,而不会完全失去依赖关系。

This enables us to release each project and framework component separately, but still keep track of the dependencies between them. We can even have multiple version of the framework components used by different projects without completely losing track of the dependencies.

到目前为止,这对我们来说非常有用 - 我只能看到两个缺点:

So far this has worked pretty well for us - I can only see two drawbacks:

需要一段时间才能进行设置,特别是如果以前没有使用过Maven。

It takes a while to set-up, especially if you have not used Maven before.

发布每个项目时有一些开销,因为您还要释放每个依赖组件,以避免依赖于其他组件的trunk版本(即Maven术语中的SNAPSHOT版本)。

There is some overhead when releasing each project, since you want to release each dependent component as well, to avoid having dependencies towards the "trunk" version of other components (i.e. the "SNAPSHOT" version in Maven terminology).

这篇关于Subversion和依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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