Delaying execution to the end of multi-module project with Maven parallel build #726
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.
What's changed?
Since PR #720 merged, I made more tests on different projects, and there is some cases where recipes are still executed before the end of all module packaging when building with Maven parallel build .
I analyzed the implementation of the
installAtEnd
anddeployAtEnd
options of themaven-install-plugin
:https://github.com/apache/maven-install-plugin/blob/master/src/main/java/org/apache/maven/plugins/install/InstallMojo.java
and
maven-install-plugin
plugins:https://github.com/apache/maven-deploy-plugin/blob/master/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
It uses mojo Context to store "state markers", presence of marker means project was "processed".
This MR is based on this implementation.
What's your motivation?
Fix #719
Anyone you would like to review specifically?
@timtebeek
Any additional context
I have added a
RewriteRunParallelIT
test, with a Maven project that have 2 modulesa
andb
.These 2 modules are build in parallel (
@MavenOption(value = MavenCLIOptions.THREADS, parameter = "2")
.And I've added a sleep Antrun task in module
a
, in order to force modulea
finish building after moduleb
.`Without this MR, this test fail, because previous implementation:
List<MavenProject> sortedProjects = mavenSession.getProjectDependencyGraph().getSortedProjects();
always return
[a,b]
project list in this order, even if modulea
is longer to build than moduleb
.Checklist