What is a "reactor" in Maven?

I read about the Maven reactor and am confused by its use of terminology. I read that a multimodule is a reactor that you can manipulate a maven reactor and that the reactor is a plugin. What is a reactor?

+80
maven maven-2 maven-reactor
Jan 12
source share
2 answers

The reactor is part of Maven, which allows it to fulfill the goal on multiple modules. As mentioned in the Maven 1.x documentation for assembling several modules (the concept of the reactor was already in Maven 1.x), while the modules are a discrete unit of work, they can be assembled using the reactor to create them simultaneously and:

The reactor determines the correct assembly order from the dependencies specified by each project in their respective project descriptors, and then fulfills the given set of goals. It can be used both for construction projects, and for other purposes, such as creating a site.

As explained, a reactor is what makes it possible to create several modules: it calculates a directed graph of dependencies between modules, deduces the construction order from this graph (why cyclic dependencies are forbidden, which is good in any case), and then performs tasks on the modules. In other words, an “assembly with multiple modules” is an “assembly of a reactor”, and an “assembly of a reactor” is an “assembly of several modules."

In Maven 2.x, support for multi-module assemblies was significantly improved, and the reactor became transparent to Maven users. But it is still there and used under the hood.

In September 2008 (i.e., long after the deployment of Maven 2), a reactor plug-in was created so that it could interact (again) more closely with the Maven reactor. Brett Porter wrote about this in Reactor: My new favorite Maven plugin .

Most of the capabilities of the reactor plugin are now supported in place (starting with Maven 2.1.0). See Maven Tips and Tricks: Advanced Reactor Options .

+138
Jan 12
source share

The reactor is used when the project has a multimodule.

The work performed by the reactor is as follows:

  • Module Information Collection
  • Dependency Based Sort
  • Builds projects in order

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

-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 

source

+2
Jan 19 '18 at 0:52
source share



All Articles