gpt4 book ai didi

maven - 在 Maven 中为多项目强加构建顺序

转载 作者:行者123 更新时间:2023-12-03 21:20:23 25 4
gpt4 key购买 nike

我在 Maven 中有一个像这样的多项目:

paren-project
-> plugin-project
-> testbed-project
plugin项目生成一个JAR,手动复制到 testbed的特定子目录下(使用任何嵌入式脚本,如 )。重要的一点:我不希望插件 JAR 位于测试床的类路径中。

但是我找不到强制在测试平台项目之前构建插件项目的解决方案。如果我将插件项目设置为 testbed 项目的依赖项,它会被添加到类路径中。

任何解决方案,或者我是否必须切换到像 这样的构建系统, ?

最佳答案

正如在 http://maven.apache.org/guides/mini/guide-multiple-modules.html 中提到的那样

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:
  1. project dependency on another module in the build
  2. plugin declaration where the plugin is another modules in the build
  3. plugin dependency on another module in the build
  4. build extension declaration on another module in the build
  5. the order declared in the modules 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

关于maven - 在 Maven 中为多项目强加构建顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6593503/

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