-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[MNG-8331] Sometimes versioned dependencies disappear #1821
Conversation
Ensure all dependencies end up in the model
Corresponding IT: apache/maven-integration-testing#393. |
There is a more trivial PR #1822 which avoids model modification if unneeded. |
Another alternative mixing the two solutions: #1823 |
@cstamas, I did not add one because in practice I do not expect many projects to have zero dependencies. If a project does have zero dependencies, the only "waste" is the allocation of an unnecessary If my assumption and/or preference is not in line with the general way in which Maven is coded, I'm happy to add the optimalization, but I'd like to check the necessity first. |
For example, all the parents, aggregators, BOMs etc will not have any of those. This is about all the "subprojects" within a project (just to clarify "I do not expect project with zero dependencies" -- they may still have subprojects with zero deps even if project as a whole does have deps) and while I cannot tell the usual ratio of things like parent vs non-parent POMs in a project, they are there. Just my 5cts |
Ugh, reformatting the file will fail the build I guess |
Avoid work when there are no dependencies
Reverted the accidental reformat, force-of-habit hotkey in IntelliJ... |
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/DefaultModelBuilder.java
Outdated
Show resolved
Hide resolved
Extract method, re-introduce optimization to return original model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes make sense to me. I'm happy to see the added IT's have passed, proving the bug is fixed.
For the IT to run, a branch in the maven-integration-testing fork with the same name than this branch and in the same org must exists. |
@gnodet There is a branch with an additional integration test (contributed by @mthmulders) which is being run in the pipeline for this PR. The PR for the integration test is apache/maven-integration-testing#393 |
This is exactly what is happening: look for |
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] SUMMARY
,where you replace
MNG-XXX
andSUMMARY
with the appropriate JIRA issue.[MNG-XXX] SUMMARY
.Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
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.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.