作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我厌倦了必须手动更改每个存储库的依赖版本并运行构建和测试。
是否有任何好的解决方案/工具可以集中处理,以便您只需更改一个文件中的版本?
一个要求是您仍然可以从本地存储库覆盖所需的版本。
最佳答案
在我的 Maven 项目中,我使用父 pom 进行依赖管理。我在父 pom 中使用“dependencyManagement”标签来声明所有可用的依赖项及其子模块的版本。
目录结构
- project-name
- module-A
- pom.xml
- pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>artifact</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<parent>
<artifactId>module-A</artifactId>
<groupId>com.test</groupId>
<version>1.0</version>
</parent>
<dependencies>
<!-- The version is inherited from parent pom -->
<dependency>
<groupId>com.test</groupId>
<artifactId>artifact</artifactId>
</dependency>
</dependencies>
关于Java/Gradle : Any tips on centralizing dependency version control for a multiple repository project?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54978786/
我是一名优秀的程序员,十分优秀!