Skip to content

Conversation

@alzimmermsft
Copy link
Contributor

@alzimmermsft alzimmermsft commented Jun 17, 2025

Fixes #2487

Adds logic to de-duplicate the list of MavenProjects being returned by FilteredProjectDependencyGraph.applyFilter to prevent building the same project multiple times in a parallel, multi-module build.

A lengthy comment is added to the main change explaining a situation where the same project could be added multiple times, which I'll repeat here.

Given the following, simplified, aggregate POM where project E has a direct dependency on all of A, B, C, and D.

<modules>
  <module>A</module>
  <module>B</module>
  <module>C</module>
  <module>D</module>
  <module>E</module>
<modules>

If a parallel build was using --pl A,C,E if FilteredProjectDependencyGraph.applyFilter was called with the aggregate POM's MavenProjects (A, B, C, D, and E) and non-transitive and downstream dependencies were being filtered for, the following would happen.

  1. A, C, and E would be added to the filtered result as they're in the whitelist.
  2. B and D would be scanned for their downstream projects as they aren't in the whitelist and transitive is false.
  3. The result of B and D's scanning would find project E as it depends on both projects.

This would result in project E being added to filtered three separate times. Once for being in the whitelist itself and twice more for being a downstream project of two projects not in the whitelist.

I also added a small bit of logic to short circuit being distincting filtered when it would effectively be a wasted no-op, when there is zero or one project in the list.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@slawekjaranowski
Copy link
Member

look ok for me @cstamas @gnodet please also look

We need do the same in master.

@slawekjaranowski slawekjaranowski added the bug Something isn't working label Jun 17, 2025
@slawekjaranowski slawekjaranowski added this to the 3.9.11 milestone Jun 17, 2025
@cstamas
Copy link
Member

cstamas commented Jun 18, 2025

Thank you for contribution! 🍻

@alzimmermsft
Copy link
Contributor Author

Glad to help @cstamas!

If this is also an issue in master, I'm happy to file a PR against it as well.

@cstamas
Copy link
Member

cstamas commented Jun 18, 2025

Feel free to do so! Let the beer flow... 😄

@slawekjaranowski slawekjaranowski merged commit 5107f47 into apache:maven-3.9.x Jun 18, 2025
18 checks passed
cstamas pushed a commit that referenced this pull request Jun 19, 2025
cstamas added a commit to cstamas/maven that referenced this pull request Jun 19, 2025
@alzimmermsft alzimmermsft deleted the DeduplicateFilteredDependencyGraph branch June 19, 2025 20:11
dongjoon-hyun added a commit to apache/orc that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

This PR aims to upgrade Maven to 3.9.11.

### Why are the changes needed?

To bring the latest bug fixes.
- https://github.com/apache/maven/releases/tag/maven-3.9.11
  - apache/maven#2489
  - apache/maven#2470
  - apache/maven#10896
  - apache/maven#2574

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #2331 from dongjoon-hyun/ORC-1958.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/orc that referenced this pull request Jul 15, 2025
### What changes were proposed in this pull request?

This PR aims to upgrade Maven to 3.9.11.

### Why are the changes needed?

To bring the latest bug fixes.
- https://github.com/apache/maven/releases/tag/maven-3.9.11
  - apache/maven#2489
  - apache/maven#2470
  - apache/maven#10896
  - apache/maven#2574

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #2331 from dongjoon-hyun/ORC-1958.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit ab9d7d0)
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun pushed a commit to apache/spark that referenced this pull request Jul 17, 2025
### What changes were proposed in this pull request?
This pr aims to upgrade maven 3.9.10 to 3.9.11.

### Why are the changes needed?
The new version brings some bug fixes:

- apache/maven#2489
- apache/maven#2470

The full release notes as follows:

- https://github.com/apache/maven/releases/tag/maven-3.9.11

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
- Pass Github Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #51491 from LuciferYang/maven-3.9.11.

Lead-authored-by: yangjie01 <[email protected]>
Co-authored-by: YangJie <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
haoyangeng-db pushed a commit to haoyangeng-db/apache-spark that referenced this pull request Jul 22, 2025
### What changes were proposed in this pull request?
This pr aims to upgrade maven 3.9.10 to 3.9.11.

### Why are the changes needed?
The new version brings some bug fixes:

- apache/maven#2489
- apache/maven#2470

The full release notes as follows:

- https://github.com/apache/maven/releases/tag/maven-3.9.11

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
- Pass Github Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes apache#51491 from LuciferYang/maven-3.9.11.

Lead-authored-by: yangjie01 <[email protected]>
Co-authored-by: YangJie <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants