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

fix(java): correctly inherit version and scope from upper/root depManagement and dependencies into parents #7541

Merged

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Sep 18, 2024

Description

Forward dependencyManagement and Properties field from root/upper POM into parents.
dependencyManagement should be used as non-root dependencyManagement

See new test for more details.

Related issues

Related PRs

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen self-assigned this Sep 18, 2024
@DmitriyLewen DmitriyLewen changed the title fix(java): correctly inherit fields from root depManagement for dependencies from parent fix(java): correctly inherit version and scope from root depManagement in dependencies Sep 20, 2024
@DmitriyLewen DmitriyLewen changed the title fix(java): correctly inherit version and scope from root depManagement in dependencies fix(java): correctly inherit version and scope from upper/root depManagement and dependencies into parents Sep 23, 2024
@DmitriyLewen DmitriyLewen marked this pull request as ready for review September 23, 2024 11:22
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263
Copy link
Collaborator

I have found out that we have probably been making a mistake for a while. We're currently evaluating the parent POM first and then merge it into the child POM, but it seems correct to merge the dependencies, dependencyManagement and properties of the parent POM into the child POM before evaluating it. In fact, I implemented it that way and it simplified things considerably.
However, I'm likely missing something. You will point out something as usual 😄

@DmitriyLewen
Copy link
Contributor Author

I tested your changes with user issue (#7537).
I also tested the cases I could think of.
I also updated one test case (added nested parents).

And looks like your changes work correctly 👍

@knqyf263
Copy link
Collaborator

Thanks for testing. It is rare that I correctly implement it once 🤣
It was good to realize the mistakes in the parent POM implementation and to be able to simplify it.

@knqyf263 knqyf263 added this pull request to the merge queue Oct 17, 2024
Merged via the queue into aquasecurity:main with commit 778df82 Oct 17, 2024
12 checks passed
@DmitriyLewen DmitriyLewen deleted the fix/pom-root-depmanagement-inherit branch October 17, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(pom): wrong inheritance of version and scope from root DepManagement in parent dependencies
2 participants