什么是“反应器"?在 Maven? [英] What is the "reactor" in Maven?

查看:29
本文介绍了什么是“反应器"?在 Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读有关 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?

推荐答案

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

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 (that's why cyclic dependencies are disallowed, which is good thing anyway) 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".

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

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.

在 2008 年 9 月(即在 Maven 2 推出之后很长一段时间),一个 reactor 插件 的创建使(再次)与 Maven 反应器更紧密地交互成为可能.Brett Porter 在 Reactor: My新的收藏夹 Maven 插件.

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.

大多数 reactor 插件功能现在都得到原生支持(自 Maven 2.1.0 起).请参阅 Maven 技巧和窍门:高级反应器选项.

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

这篇关于什么是“反应器"?在 Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆