Add integration test for Maven 4 new dependency scopes (MNG-8750) #11025
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.
Summary
This PR adds a comprehensive integration test for the new dependency scopes introduced in Maven 4:
compile-only
: Available during compilation, not at runtimetest-only
: Available during test compilation, not at test runtimetest-runtime
: Available during test runtime, not at test compilationTest Coverage
The integration test (
MavenITmng8750NewScopesTest
) verifies:✅ Classpath Inclusion/Exclusion:
compile-only
dependencies appear in compile classpath but NOT runtime classpathtest-only
dependencies appear in test compile classpath but NOT test runtime classpathtest-runtime
dependencies appear in test runtime classpath but NOT test compile classpath✅ Consumer POM Compatibility:
✅ Runtime Behavior:
NoClassDefFoundError
when accessed incorrectlyTest Structure
Main Test Class:
MavenITmng8750NewScopesTest.java
super("[4.0.0,)")
)Test Modules:
compile-only-test
- Tests compile-only scope behaviortest-only-test
- Tests test-only scope behaviortest-runtime-test
- Tests test-runtime scope behaviorcomprehensive-test
- Tests all scopes working togethervalidation-failure-test
validation-success-test
Test Repository: Local repository with test dependency JARs and POMs
Files Added
Verification
The test can be run with:
mvn test -Dits.test=MavenITmng8750NewScopesTest
This ensures that the new Maven 4 scopes work as designed while maintaining backward compatibility through proper consumer POM generation.
Pull Request opened by Augment Code with guidance from the PR author