Repository navigation
Add LOAD_PROJECT request type for projects loaded from a POM file - #13669
Conversation
Fixes apache#13395. Co-authored-by: Abdul Hannan <abdulhannansyed548@gmail.com>
gnodet-bot
left a comment
There was a problem hiding this comment.
Thanks for the clean refactoring — the introduction of LOAD_PROJECT request type and isStrictRequest() is a nice improvement to the model-building semantics.
One test-code observation:
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
Thanks. processPlugins=false is a consumer request that never looks up a local parent, so it isn’t meaningful for this test. I’ve replaced the single-value loop with a plain setProcessPlugins(true) and a comment. |
gnodet-bot
left a comment
There was a problem hiding this comment.
Previous findings are all addressed. The List.of(true) dead-loop concern is resolved — the test now iterates over validation levels (MINIMAL, STRICT) correctly.
LGTM. The LOAD_PROJECT semantics are correct: isBuildRequest() includes it for project-level operations (local parent lookup, profile activation, pomFile assignment), while isStrictRequest() excludes it from strict parsing and validation. All four validation call sites in DefaultModelBuilder were updated consistently. isBuildRequestWithActivation() already returns true for LOAD_PROJECT (it excludes only BUILD_CONSUMER) without any code change — profile activation works correctly.
The test covers the two distinct code paths introduced by the PR (MINIMAL → LOAD_PROJECT → lenient, STRICT → BUILD_EFFECTIVE → strict) and correctly asserts both local parent resolution (works for both levels) and the relativePath warning (only for STRICT).
Note: PRs #13394 and #13601 are still open and target the same issue — they should be closed when this merges.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
Hi @gnodet, Just following up on this PR. The requested review changes have been addressed, the branch is up to date with master, and all 21 checks are passing. Since the PR has been approved, could you please let me know if anything else is needed before merging? Thanks again for your time and review! |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds a new ModelBuilderRequest.RequestType.LOAD_PROJECT to allow “project semantics” (local parent lookup, profile activation) while keeping lenient parsing/minimal validation for non-build usage (e.g., IDEs), and wires it through model building and project building.
Changes:
- Introduces
RequestType.LOAD_PROJECTin the public API with semantics/validation expectations. - Updates
DefaultProjectBuilderto selectLOAD_PROJECTvsBUILD_EFFECTIVEbased onprocessPlugins+ validation level. - Updates
DefaultModelBuilderto distinguish “project semantics” from “strict parsing/validation”, plus adds a regression test.
| File | Description |
|---|---|
| impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java | Separates “strict parsing/validation” from “project request semantics” with isStrictRequest() and extends “project” behavior to LOAD_PROJECT. |
| impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java | Chooses LOAD_PROJECT for filesystem POM loads with plugins processing unless validation is STRICT (then BUILD_EFFECTIVE). |
| api/maven-api-core/src/main/java/org/apache/maven/api/services/ModelBuilderRequest.java | Adds the new public RequestType.LOAD_PROJECT enum constant + Javadoc. |
| impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java | Adds regression coverage for local parent resolution and warning behavior across validation levels. |
Review effort: Lite
…uest/isStrictRequest Javadoc - Add comment explaining why the child POM uses modelVersion 4.1.0 (the validation warning for redundant relativePath only fires for non-4.0.0 model versions, so 4.0.0 would make the test a no-op) - Make the problem assertion more robust: match on Severity.WARNING and the stable field name 'parent.relativePath' in the message, rather than a substring of the mutable message body - Make isStrictRequest() an explicit positive check instead of negating isBuildRequest(), and add a Javadoc to isBuildRequest() clarifying that LOAD_PROJECT is included for project-level semantics (local parents, profile activation) but not strict validation

Fixes #13395.
Implements the design suggested in the review of #13601: a new
RequestType.LOAD_PROJECTinstead of exposing a validation level onModelBuilderRequest.LOAD_PROJECTgets the project treatment (local parent lookup, profile activation) but is parsed and validated leniently, like the consumer request types.BUILD_EFFECTIVE.BUILD_EFFECTIVEif the validation level is STRICT, andLOAD_PROJECTotherwise. Every non-STRICT compat level gets MINIMAL validation, as before.Testing (Windows, JDK 25):
ProjectBuilderTest#testLocalParentResolutionWithValidationLevelspasses on current master. On the previous base I also ran the maven-coreorg.apache.maven.projecttests and the maven-impl model and cache tests (259 run in maven-core, 0 failures). I haven't runmvn -Prun-its verify, so CI is the real check.