Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delaying execution to the end of multi-module project with Maven parallel build #726

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Conversation

philippe-granet
Copy link
Contributor

@philippe-granet philippe-granet commented Jan 31, 2024

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 and deployAtEnd options of the maven-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 modules a and b.
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 module a finish building after module b.`

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 module a is longer to build than module b.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for coming back with the detailed fix!

@timtebeek timtebeek added bug Something isn't working enhancement New feature or request labels Jan 31, 2024
@timtebeek timtebeek merged commit 38eb90b into openrewrite:main Jan 31, 2024
1 check passed
timtebeek added a commit that referenced this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Delaying execution to the end of multi-module project
2 participants