gpt4 book ai didi

java - Maven 构建顺序(多个模块)

转载 作者:IT老高 更新时间:2023-10-28 11:21:09 24 4
gpt4 key购买 nike

我有一个 Maven 父项目,它有多个子/模块...我有以下 pom.xml 作为主/父项目;

<modules>
<module>Main-Ear</module>
<module>Sub-Web</module>
<module>Sub-Ui</module>
<module>Sub-Services</module>
<module>Sub-SSO-Login</module>
</modules>

但是,我发现实际的构建顺序有所不同...构建后,实际顺序如下:

Main
Sub-Services
Sub-SSO-Login
Sub-UI
Sub-Web
Main-Ear

在这种情况下,Maven 究竟从哪里获取构建顺序?

最佳答案

您无法手动控制构建顺序:

来自 Maven 项目文档 (Guide to Working with Multiple Modules):

Reactor Sorting

Because modules within a multi-module build can depend on each other, it is important that The reactor sorts all the projects in a way that guarantees any project is built before it is required.

The following relationships are honoured when sorting projects:

  • a project dependency on another module in the build
  • a plugin declaration where the plugin is another modules in the build
  • a plugin dependency on another module in the build
  • a build extension declaration on another module in the build the order declared in the element (if no other rule applies)

Note that only "instantiated" references are used - dependencyManagement and pluginManagement elements will not cause a change to the reactor sort order

关于java - Maven 构建顺序(多个模块),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18629897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com