我必须重构一个使用 Maven 的 Java 单体应用程序。当前的应用程序有很多依赖项(我的意思是,很多。比如 100-150 个),许多配置文件和插件。所有这些都将被模块化,并将集成到 GitLab 管道中,并带有适当的工件存储库。
我检查了许多有关 maven 和 boms 的示例。
所以我在考虑这样的结构:
project/BOM/pom.xml //the only dependency manager for the whole project
project/pom.xml //this will be the root pom, and will import the BOM as a <dependency>, as the <parent> is reserved for the Enterprise management.
project/repo1/pom.xml // this will import the project/pom as the parent.
project/repo1/node1/pom.xml //this will use the dependencies imported by the BOM module
project/repo1/node2/pom.xml //same
project/repo2/pom.xml //same
...
etc.
这是“最佳实践”工业化配置还是应该将 bom 嵌入到主 pom 中?
我知道应该在 repos 之间拆分依赖关系,但问题是我们有交叉链接的依赖关系,当时我现在无法处理它们。所以我必须尽可能集中所有这些。