问题描述
我在maven中有一个这样的多项目:
I have a multi project in maven like this:
paren-project
-> plugin-project
-> testbed-project
plugin
项目生成一个JAR,将其手动复制到testbed
的特定子目录(使用诸如 groovy 或 ant ).重要的一点:我不希望插件JAR位于测试平台的类路径中.
The plugin
project generates a JAR, which is manually copied to a specific subdirectory of testbed
(using whatever embedded script like groovy or ant). The important point: I don't want the plugin JAR to be in the classpath of testbed.
但是我找不到强制在测试平台项目之前构建插件项目的解决方案.如果我将插件项目设置为测试平台项目的依赖项,则会将其添加到类路径中.
But I cannot found the solution to force the plugin project to be build BEFORE the testbed project. If I set the plugin project as dependency of the testbed project, it is added in the classpath.
任何解决方案,还是我必须切换到 gradle , ivy 或 ant 吗?
Any solution, or do I have to switch to a build system like gradle, ivy or ant ?
推荐答案
在 http://maven.apache.org/guides/mini/guide-multiple-modules.html
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:
- 项目对构建中另一个模块的依赖
- 插件声明,其中插件是构建中的另一个模块
- 插件依赖于构建中的另一个模块
- 在构建中另一个模块上的构建扩展声明
- 在modules元素中声明的顺序(如果没有其他规则适用)
- project dependency on another module in the build
- plugin declaration where the plugin is another modules in the build
- plugin dependency on another module in the build
- build extension declaration on another module in the build
- the order declared in the modules element (if no other rule applies)
请注意,仅使用实例化"引用-dependencyManagement 和pluginManagement元素不会导致更改反应堆排序顺序
Note that only "instantiated" references are used - dependencyManagement and pluginManagement elements will not cause a change to the reactor sort order
这篇关于在Maven中为多项目强加构建顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!