Maven:我应该保留还是删除也是传递依赖关系的声明依赖项? [英] Maven : Should I keep or remove declared dependencies that are also transitives dependencies?

查看:192
本文介绍了Maven:我应该保留还是删除也是传递依赖关系的声明依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你认为删除在maven pom中可以找到的每个传递依赖是个好习惯吗?



示例:

我的项目取决于A和B.

B也是A的传递依赖。 >
我应该保持B在我的pom还是删除它?什么是最好的?

具有所有已知的罐子,即使是传递性的,在pom上宣布还是只保留顶级罐子?



这是一个有点主观,但我试图清理一些巨大的庞巴姆(父母和孩子)与大量的传递依赖。我想保持我的pom尽可能简单,但我也希望他们是可维护的。

解决方案

如果您的项目对B有直接依赖关系,那么即使B是A的传递依赖,也应该保留它。在下一个版本中,A不会使用B,您将不得不重组pom.xml。



通常,Maven依赖关系应反映逻辑项目依赖关系。


Do you think it is a good practice to remove every transitive dependencies that can be found in a maven pom?

Example:
My project depends on A and B.
B is also a transitive dependency of A.
Should I keep B in my pom or remove it ?

What is the best:
having all known jars, even transitive one, declared on the pom or keeping only the top level jars ?

This is a little bit subjective, but I am trying to clean some huge poms (parent and children) with a lot of transitive dependencies. I want to keep my pom as simple as possible, but I want also them to be maintainable.

解决方案

If your project has direct dependencies on B then you should keep it even if B is a transitive dependency of A. It can be that in the next version A won't use B an you'll have to restructure the pom.xml.

Generally, Maven dependencies should reflect the logical project dependencies.

这篇关于Maven:我应该保留还是删除也是传递依赖关系的声明依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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