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

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

本文介绍了在Maven中为多项目强加构建顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在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:
  1. 项目对构建中另一个模块的依赖
  2. 插件声明,其中插件是构建中的另一个模块
  3. 插件依赖于构建中的另一个模块
  4. 在构建中另一个模块上的构建扩展声明
  5. 在modules元素中声明的顺序(如果没有其他规则适用)
  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)

请注意,仅使用实例化"引用-dependencyManagement 和pluginManagement元素不会导致更改反应堆排序顺序

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

这篇关于在Maven中为多项目强加构建顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 21:45