最近项目里用到了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