[MNG-8052] New lifecycle for Maven 4 #1448
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA issue: MNG-8052
The lifecycle is now defined as a tree of phases, each phase being split with a
before:
phase and aafter:
phase. Each phase is given a list of timing constraints: a phase from the same lifecycle (compile
must be executed aftersources
), a phase in project dependencies (compile
must execute aftercompile-only
project dependencies have reached theready
phase), or a set of children project dependencies (to re-define aggregators, not yet implemented).The default lifecycle is defined in the
DefaultLifecycleRegistry
In addition to the
before:
andafter:
prefixes, an ordering can be defined by appending an integer inside brackets, for example,after:integration-test[1000]
.Note that there are a few changes with the Maven 3 default lifecycle: it's a graph, so
sources
does not always execute afterresources
, norcompile
afterresources
. Also, unit tests and integration tests have been moved to theverify
phase which is run last inside thebuild
phase, but not in thepackage
phase. The goal is to have a phase (here,package
which can run all the reactor with no tests). In order to be compatible, old phases are mapped to new ones using aliases. Theinstall
anddeploy
phases now depends onpackage
, but notverify
(anddeploy
does not requireinstall
). This currently has no effect when callingmvn deploy
, as the ordered list of phases is still used to compute the build plan (see #1429).It's missing the ability to create some scheduling constraints in the POM and to define custom phases. All executions in a given phase such as
compile
orafter:sources
are executed sequentially, but it would be nice to be able to execute them in different subphases, so that they could be executed concurrently.This PR is required for #1429