java - 何时创建 Maven 子模块

标签 java maven

目前我正在一个项目中工作,该项目在一个父 pom 下包含 260 个 Maven 子模块。这似乎会减慢构建速度。这就是为什么我提出了这个问题:什么时候应该使用子模块,什么时候不应该使用它。

最佳答案

Introduction to the POM说:

If you have several Maven projects, and they all have similar configurations, you can refactor your projects by pulling out those similar configurations and making a parent project. Thus, all you have to do is to let your Maven projects inherit that parent project, and those configurations would then be applied to all of them.

And if you have a group of projects that are built or processed together, you can create a parent project and have that parent project declare those projects as its modules. By doing so, you'd only have to build the parent and the rest will follow.

在以下情况下创建子模块:

  • 项目共享相同的配置,以避免配置重复
  • 项目相互关联,让构建变得更容易

关于java - 何时创建 Maven 子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56881744/

相关文章:

java - Authorize.net Java SDK(2.0.1v) 环境未设置问题

java - Joda 在 GMT 时区解析 ISO8601 日期

java - 为什么我不能对 Annotation 的引用使用 getAnnotation()?

java - 如何强制 Jetty 的 Maven 插件关闭其文件句柄?

java - Spring 启动 : use of Maven properties configured in yaml

java - 如何在Spring Security 3.0中为用户详细信息对象设置自定义属性

java - 如何计算Java中两个日期之间的年月年龄

maven - 如何提交新的 Maven 插件

java - 为什么在我编译我的应用程序时缺少一个类?

maven - 在 Maven Assembly Plugin TAR 存档中设置文件所有者