从多模块pom构建单个模块 [英] Build single module from multimodule pom

查看:142
本文介绍了从多模块pom构建单个模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?

环境:多模块pom由3个模块组成:mm1,mm2,mm3.模块mm2具有mm1作为依存关系.可以构建父pom而不会出现任何错误.

The environment: Multimodule pom consists of 3 modules: mm1, mm2, mm3. Module mm2 has mm1 as dependency. It is possible to build parent pom without any errors.

问题:是否可以在不将mm1安装到本地存储库的情况下构建单个模块mm2(即从mm2基本目录运行maven)?

The question: Is it possible to build single module mm2 (i.e., run maven from mm2 base directory) without installing mm1 into local repository?

谢谢.

推荐答案

没有自动安装,则不能,但是可以仅构建选定的项目.您需要具有多模块构建(我假设您可以这样做).在反应堆模式下,每个命令都必须从反应堆的根目录运行.

Without automatic installing not, but it's possible to build only choosen projects. You need to have multi module build (I'm assuming you do). In reactor mode every command need to be run from the root of reactor.

所以在您的情况下:

mvn reactor:make -Dmake.folders=mm2

在这种情况下,您将构建mm2模块及其依赖的模块(mm1).

In this case you build mm2 module and modules on which it depends (mm1).

有用的链接:

  • Maven reactor plugin reference
  • Maven book reactor chapter

从书本示例中,我仅构建项目持久性和他的依赖项目模型.其他项目未受影响 mvn reactor:make -Dmake.folders=sample-persist

From book examples I build only project persist and his dependency project model. Others projects are untouched with mvn reactor:make -Dmake.folders=sample-persist

替代文字http://www .sonatype.com/books/maven-book/reference/figs/web/running_aro-dependencies.png

其他有用的命令是reactor:make-dependents,该命令可构建依赖X的项目.

Other useful command is reactor:make-dependents which build projects that depend on X.

这篇关于从多模块pom构建单个模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆