java - 为什么 Maven 中的动态版本范围没有最初预期的那么有用?

标签 java python maven

我一直在 Maven/POM 中使用显式版本的 Java 依赖项。

然后有一段时间我切换到Python,在那里我了解到依赖版本范围(例如> = 2.3.0)非常流行,并且似乎限制了依赖冲突的问题:两个范围重叠的可能性比这要高两个精确版本是相等的。我想知道为什么 Maven/POM 世界中不存在这样的解决方案?

然后我收到了有关我的 GitHub 项目依赖项中存在漏洞的通知以及将其升级到的建议:

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>[2.9.9,)</version>
</dependency>

太棒了,我想,Maven 中有依赖版本范围!我不需要经常更新我的依赖项。但后来,我读到 they are de facto depracated ,因为:

  • they are not as useful as originally intended, and also that they are unlikely to get improvements without a significant re-think.

  • 还有那个

    Resolution of dependency ranges should not resolve to a snapshot (development version) unless it is included as an explicit boundary

    但似乎有 bug 那里(于 2007 年提出并于 2018 年重新开放)。

为什么它们没有最初预期的那么有用?

除了 Maven 之外,还有其他 Java 框架可以处理依赖版本范围吗?

最佳答案

其他选项是 Gradle 。 从其文档中“如果依赖项被声明为动态版本(如 1.+、[1.0,)、[1.0, 2.0)),Gradle 会将其解析为存储库中最高可用的具体版本(如 1.2)”

关于java - 为什么 Maven 中的动态版本范围没有最初预期的那么有用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56446857/

相关文章:

java - 在类路径上找不到 log4j - Maven

maven - tomcat-maven-plugin 403错误

java - Spring 启动: Renaming the Main class

java - 如何使用 JGit 获取存储库中每个文件的更改次数?

java - Java 中的 CSV 自动检测

python - 通过循环和参数组合多个函数

python - 如何使用回车键调用按钮命令

java - 如何在单击箭头时展开列表(如 YouTube)

java - 如何从 setOnItemSelectedListener 方法获取字符串?

Python 正则表达式 : return the whole sentence with a certain word in it from period to period