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

[MNG-8012] Warn if in-reactor BOM import happens #1434

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Mar 1, 2024

This should be in fact prevented.
Also, model builder missed File uses are corrected.


https://issues.apache.org/jira/browse/MNG-8012

@cstamas cstamas requested a review from gnodet March 1, 2024 15:59
@cstamas cstamas self-assigned this Mar 1, 2024
@cstamas cstamas added this to the 4.0.0-alpha-13 milestone Mar 1, 2024
@@ -1830,6 +1845,15 @@ private org.apache.maven.api.model.DependencyManagement doLoadDependencyManageme
return null;
}

if (importSource instanceof FileModelSource && request.getRootDirectory() != null) {
URI sourceUri = ((FileModelSource) importSource).getLocationURI();
if (request.getRootDirectory().toUri().relativize(sourceUri) != sourceUri) {
Copy link
Contributor

@gnodet gnodet Mar 1, 2024

Choose a reason for hiding this comment

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

Fwiw, this test is unintuitive... a comment would be welcomed. I had to check the javadoc...
Or maybe using FileModelSource#getPath() instead or URIs ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't want to be pushy, but what about the following ?

Path sourcePath = ((FileModelSource) importSource).getPath();
if (sourcePath.startsWith(request.getRootDirectory()) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed, so who's pushy now?

Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

LGTM

@cstamas cstamas merged commit 5029cc2 into apache:master Mar 1, 2024
18 checks passed
@cstamas cstamas deleted the MNG-8012 branch March 1, 2024 17:27
@reckart
Copy link
Member

reckart commented Oct 30, 2024

I believe this implementation is incomplete. It does not discern between a BOM (a module which manages the versions of the modules in the reactor) and a dependency management module (a module which manages the versions of external libraries used in the reactor).

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.

3 participants