简体   繁体   English

管理依赖项的版本

[英]Managing Versions of dependencies

What is best way of managing versions of dependencies?. 管理依赖项版本的最佳方法是什么?

Generally I would create a super POM (Not Parent POM) and I would declare all my dependencies in the super POM. 通常我会创建一个超级POM(非父POM),我会在超级POM中声明所有依赖项。 So that all my projects can refer that POM for the dependencies. 所以我的所有项目都可以引用POM来获取依赖项。 The advantage is that all my dependencies are controlled from a central POM. 优点是我的所有依赖项都是从中央POM控制的。

But if we are developing some products selling to different clients year after year and also dependencies versions get updated year after year. 但是,如果我们年复一年地开发一些销售给不同客户的产品,并且依赖版本会逐年更新。 How will I keep track of my dependency versions of products I released to each client?.. I don't want to keep updating my POM every time a dependency version needs to be updated. 我如何跟踪我发布给每个客户端的产品的依赖项版本?..每次需要更新依赖版本时,我都不想继续更新我的POM。

So I was thinking of keeping the version of dependencies in my settings xml as properties and settings can be updated or version-ed per release. 所以我想在我的设置xml中保留依赖项的版本,因为每个版本的属性和设置都可以更新或版本化。

I am experienced in Maven but not an expert. 我在Maven有经验,但不是专家。 Any good suggestions?... Thanks In Advance Joseph 有什么好建议吗?...先谢谢约瑟夫

  • Put all your version in the dependencyManagement of the parent pom. 将所有版本放在父pom的dependencyManagement中。 (as you do now, that's why dependencyManagement exists) (正如你现在所做的那样,这就是dependencyManagement存在的原因)
  • To keep track of old release : use a tag in SCM. 要跟踪旧版本:在SCM中使用标记。
  • settings.xml in not part of the project! settings.xml不属于项目的一部分! it is there to contains properties and data about the build environment (ie not the project). 它包含有关构建环境的属性和数据(即不是项目)。
  • don't mix dependencies of different projects. 不要混合不同项目的依赖关系。 It seems a very bad idea (it means that if you uddate a widely used dependency (like hibernate for instance) for one particular customer: it will be updated for all your projects. And so you will have to re-validate all your projects against the new version of hibernate) 这似乎是一个非常糟糕的想法(这意味着如果你为一个特定的客户创建一个广泛使用的依赖项(例如hibernate):它将针对你的所有项目进行更新。所以你必须重新验证你所有的项目新版本的hibernate)

And just a little question, what difference do you make between versioning your settings.xml and versioning your parent pom ? 还有一个小问题,您在对settings.xml进行版本控制和对父pom进行版本控制之间有何不同?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM