core(consumer-pom): drop compile-only/test-only; map test-runtime -> test; adjust tests#11126
Closed
gnodet wants to merge 3 commits intoapache:masterfrom
Closed
core(consumer-pom): drop compile-only/test-only; map test-runtime -> test; adjust tests#11126gnodet wants to merge 3 commits intoapache:masterfrom
gnodet wants to merge 3 commits intoapache:masterfrom
Conversation
cstamas
reviewed
Sep 16, 2025
| } | ||
|
|
||
| // Handle new Maven 4 scopes when creating consumer POM | ||
| switch (scope) { |
Member
There was a problem hiding this comment.
Looks good, but one nit: could we do this programmatically? We do have mvn3 scope manager config and we do have mvn4 scope manager config as well.... I would really like to have all scopes managed at single place, unlike in mvn3 when they are smeared across many classes in many projects (maven, resolver, many plugins, etc)
Contributor
Author
There was a problem hiding this comment.
I moved the logic into Maven4ScopeManagerConfiguration. @cstamas is that what you were asking for ?
cstamas
approved these changes
Sep 16, 2025
…test; adjust tests
- DefaultConsumerPomBuilder.transformDependencyForConsumerPom:
- Omit Maven 4–only compile-only and test-only scopes from the consumer POM (build-time only, not needed by downstream consumers).
- Map Maven 4–only test-runtime to the classic test scope for the consumer POM.
This preserves the producer’s test runtime dependencies for consumers while staying compatible with the 4.0.0 model and Maven 3.x tooling.
- Keep all classic scopes (compile/provided/runtime/test/system) unchanged.
- Apply the transformation consistently for both direct dependencies and dependencyManagement entries (existing streams already funnel through transformDependencyForConsumerPom and then filter nulls).
- Tests: update ConsumerPomBuilderTest to reflect policy:
- compile-only → omitted
- test-only → omitted
- test-runtime → preserved and mapped to scope=test
- classic scopes unchanged
- existing SCM inheritance and consumer POM shape tests remain
Rationale:
- The consumer POM targets a 4.0.0 model to be consumable by Maven 3.x and other tools.
- compile-only and test-only are build-time-only concerns and have no safe Maven 3 equivalent; dropping them keeps the consumer POM minimal and compatible.
- test-runtime has no exact Maven 3 analog; mapping to test is the closest approximation and keeps relevant test runtime deps visible to consumers. test scope is non-transitive, so this does not leak into downstream compile/runtime classpaths.
Formatting:
- Ran Spotless on the affected module.
- Add mapScopeForMaven3ConsumerPom() method to Maven4ScopeManagerConfiguration - Update DefaultConsumerPomBuilder to use consolidated scope mapping - Remove separate ConsumerPomScopeMapper class to reduce code duplication - Centralize all Maven 4 scope-related logic in single location - Apply code formatting with spotless This change improves code organization by consolidating related scope mapping functionality while maintaining the same behavior for consumer POM generation.
Contributor
Author
|
Superseded by #11163 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the consumer POM generation to handle Maven 4–only test scopes in a way that is both minimal and Maven 3 compatible, while preserving relevant test runtime information for consumers.
Changes:
Rationale:
See #11012