与多模块项目的Maven阶段顺序? [英] Maven phase order with mulit-module project?

查看:83
本文介绍了与多模块项目的Maven阶段顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原谅我.我是Maven的菜鸟.

Forgive me. I'm a noob at Maven.

这是我的maven项目目录:

Here is my maven project directory:

project/
    pom.xml
    moduleA/
    moduleB/
        sub-moduleA/
        sub-moduleB/
        sub-moduleC/
    moduleC/

当然,在每个模块和子模块中,它们都有自己的pom.xml.同样,在此示例中,moduleB依赖于moduleA,而moduleA依赖于moduleC.我知道在Maven中它经历了多个阶段,但是它是一次完成每个阶段,还是一次完成每个模块.现在,我关心的仅有三个阶段是compilepackageinstall.

Of course, within each module and sub-module, they have their own pom.xml. Also, in this example moduleB depends on moduleA and moduleA depends on moduleC. I know in maven there are multiple phases it goes through, but does it take each phase one at a time, or take each module one at a time. Right now, the only three phases I'm concerned with is compile, package, and install.

例如:

它是否按照第1项进行操作:

compile moduleC
compile moduleA
compile moduleB
package moduleC
package moduleA
package moduleB
install moduleC
install moduleA
install moduleB

还是按第2项进行操作:

compile moduleC
package moduleC
install moduleC
compile moduleA
package moduleA
install moduleA
compile moduleB
package moduleB
install moduleB

或者它以完全不同的顺序执行,还是我只是完全不了解maven?

Or does it do it in a totally different order, or am I just completely off in my understanding in maven?

我正在运行Maven 2.2.1.谢谢!

I'm running Maven 2.2.1. Thanks!

推荐答案

第2步:反应堆检测到所有项目,建立排序列表以按正确的顺序构建项目(尊重相关性),然后构建项目,遵循此顺序.

Order 2 : The reactor detects all the projects, build a sorted list to build the projects in the right order (respecting dependencies), and then builds the projects, following this order.

如果A依赖于B,那么如果B未被完全处理,则无法开始构建A.

If A depends on B, you cannot start to build A if B is not totally processed.

这篇关于与多模块项目的Maven阶段顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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