什么是“反应堆”?在马文?

发布于 2024-08-17 18:30:31 字数 97 浏览 6 评论 0原文

我一直在阅读有关 Maven Reactor 的内容,并对它的术语用法感到困惑。我读过,多模块是一个反应器,您可以操作 Maven 反应器,并且反应器是一个插件。反应堆到底是什么?

I've been reading about Maven reactor and am confused by its terminology usage. I've read that a multi-module is a reactor, that you can manipulate the maven reactor and that the reactor is a plugin. What exactly is the reactor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巨坚强 2024-08-24 18:30:31

反应器是 Maven 的一部分,允许它在一组模块上执行目标。正如 Maven 1.x 有关多模块构建的文档 (反应器概念已经存在于 Maven 1.x 中),虽然模块是离散的工作单元,但可以使用反应器将它们聚集在一起以同时构建它们并且:

反应器根据每个项目在各自项目描述符中声明的依赖关系确定正确的构建顺序,然后执行一组声明的目标。它既可用于构建项目,也可用于其他目标,例如网站生成。

正如所解释的,反应器使多模块构建成为可能:它计算模块之间依赖关系的有向图,通过拓扑排序从该图导出构建顺序(这就是不允许循环依赖的原因),然后在模块上执行目标。换句话说,“多模块构建”是“反应堆构建”,“反应堆构建”是“多模块构建”。

在 Maven 2.x 中,对多模块构建的支持得到了很大的改进,并且反应器对 Maven 用户变得透明。但它仍然存在并且在幕后使用。

2008 年 9 月(即 Maven 2 推出后很长一段时间),一个 reactor 插件< /a> 的创建是为了能够(再次)与 Maven Reactor 进行更密切的交互。 Brett Porter 在 Reactor:我的新博客中介绍了它最喜欢的 Maven 插件

大多数 Reactor 插件功能现在都得到原生支持(自 Maven 2.1.0 起)。请参阅 Maven 提示和技巧:高级 Reactor 选项< /a>.

The reactor is the part of Maven that allows it to execute a goal on a set of modules. As mentioned in the Maven 1.x documentation on multi-modules builds (the reactor concept was already there in Maven 1.x), while modules are discrete unit of work, they can be gathered together using the reactor to build them simultaneously and:

The reactor determines the correct build order from the dependencies stated by each project in their respective project descriptors, and will then execute a stated set of goals. It can be used for both building projects and other goals, such as site generation.

As explained, the reactor is what makes multi-module builds possible: it computes the directed graph of dependencies between modules, derives the build order from this graph via topological sort (that's why cyclic dependencies are disallowed) and then executes goals on the modules. In other words, a "multi-modules build" is a "reactor build" and a "reactor build" is a "multi-modules build".

In Maven 2.x, the support of multi-module builds has been very much improved and the reactor has become transparent to Maven users. But it's still there and is used under the hood.

In September 2008 (i.e. a long time after the rollout of Maven 2), a reactor plugin has been created to make it possible to interact (again) more closely with the Maven reactor. Brett Porter blogged about it in Reactor: My New Favourite Maven Plugin.

Most of the reactor plugin features are now natively supported (since Maven 2.1.0). See Maven Tips and Tricks: Advanced Reactor Options.

一梦等七年七年为一梦 2024-08-24 18:30:31

当项目有多个模块时使用 Reactor。

reactor 完成的工作是:

  • 收集模块详细信息
  • 根据依赖关系对顺序进行排序
  • 按顺序构建项目

从 2.1 版本开始,有新的命令行选项,允许您操纵 Maven 构建多模块项目的方式。这些新选项是:

-rf, --resume-from
    Resume reactor from specified project
-pl, --projects
    Build specified reactor projects instead of all projects
-am, --also-make
    If project list is specified, also build projects required by the list
-amd, --also-make-dependents
    If project list is specified, also build projects that depend on projects on the list  

更多详细信息:

Reactor is used when a project has multi-modules.

The work done by reactor is:

  • Collecting the module details
  • Sorting the order based on dependencies
  • Building the projects in order

Starting with the 2.1 release, there are new command line options which allow you to manipulate the way Maven will build multi-module projects. These new options are:

-rf, --resume-from
    Resume reactor from specified project
-pl, --projects
    Build specified reactor projects instead of all projects
-am, --also-make
    If project list is specified, also build projects required by the list
-amd, --also-make-dependents
    If project list is specified, also build projects that depend on projects on the list  

More details:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文