最近项目里用到了maven的多模块,由于项目比较大,每次修改后构建整个工程构建耗时太久,计划单独构建某个模块,mvn有支持的选项:
-pl,--projects <arg> Comma-delimited list of specified
reactor projects to build instead
of all projects. A project can be
specified by [groupId]:artifactId
or by its relative path
-am,--also-make If project list is specified, also
build projects required by the
list
-amd,--also-make-dependents If project list is specified, also
build projects that depend on
projects on the list
首先切换到工程的根目录,
单独构建模块 mall4j-gateway,同时会构建 mall4j-gateway 模块依赖的其他模块
mvn install -pl mall4j-gateway -am
单独构建模块 mall4j-gateway,同时构建依赖模块 mall4j-gateway 的其他模块
mvn install -pl mall4j-gateway -am -amd
使用Maven高效构建:单独构建及依赖管理
本文介绍了如何使用Maven的 `-pl`、`-am` 和 `-amd` 参数来加快大型项目的构建过程。通过指定项目路径或ID,可以单独构建特定模块,同时根据需要构建其依赖项或被依赖的项目,显著提高开发效率。
846

被折叠的 条评论
为什么被折叠?



