-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Unify source tracking with SourceHandlingContext (#11612) #11632
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
Open
ascheman
wants to merge
5
commits into
apache:master
Choose a base branch
from
support-and-care:feature/11612-source-handling-context
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Unify source tracking with SourceHandlingContext (#11612) #11632
ascheman
wants to merge
5
commits into
apache:master
from
support-and-care:feature/11612-source-handling-context
+719
−68
Conversation
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
impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java
Outdated
Show resolved
Hide resolved
impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java
Outdated
Show resolved
Hide resolved
impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java
Outdated
Show resolved
Hide resolved
impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java
Show resolved
Hide resolved
impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java
Show resolved
Hide resolved
impl/maven-core/src/test/projects/project-builder/mixed-sources/pom.xml
Outdated
Show resolved
Hide resolved
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
impl/maven-core/src/test/projects/project-builder/sources-mixed-modules/pom.xml
Outdated
Show resolved
Hide resolved
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
159d2ae to
63d43d5
Compare
Replace boolean flags (hasMain, hasTest, etc.) with flexible set-based tracking for all language/scope combinations. - Rename ResourceHandlingContext to SourceHandlingContext - Add duplicate detection with WARNING for enabled sources - Add hasSources() method for checking language/scope combinations - Rename 'src' variable to 'sourceRoot' for clarity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use Java 17+ Stream.toList() instead of Collectors.toList(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Normalize path separators to forward slashes before comparing directory paths in tests. On Windows, Path.toString() returns backslashes, causing contains() checks with forward slashes to fail. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement validation rules for modular source handling (apache#11612): - AC6: ERROR when mixing modular (with module) and classic (without module) sources within <sources> - AC7: WARNING when legacy <sourceDirectory>/<testSourceDirectory> are used in modular projects (both explicit config and filesystem existence) Changes: - Add validateNoMixedModularAndClassicSources() to SourceHandlingContext - Add warnIfExplicitLegacyDirectory() to DefaultProjectBuilder - Update tests to verify AC6 and AC7 behavior - Update test project comments to reflect correct behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
63d43d5 to
19fd98d
Compare
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
Outdated
Show resolved
Hide resolved
desruisseaux
reviewed
Feb 1, 2026
impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Outdated
Show resolved
Hide resolved
- Use flatMap(Optional::stream) instead of filter/map - Use File.separatorChar instead of hardcoded backslash - Simplify module checks with orElse(null) - Make getProfileIds() static Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
desruisseaux
approved these changes
Feb 1, 2026
Contributor
|
@gnodet or others, any objection in merging this commit? |
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.
Summary
hasMain,hasTest,hasMainResources, etc.) with flexible set-based tracking usingSourceHandlingContextResourceHandlingContexttoSourceHandlingContextto reflect unified handling of all source typeshasSources(Language, ProjectScope)method for checking source existenceCollectors.toList()with.toList()(Java 17+ idiom)Closes #11612 (Phase 2: build-sources-validation)
Test plan
ProjectBuilderTestpasses (19 tests)testModularSourcesInjectResourceRoots- verifies module-aware resource injectiontestModularSourcesWithExplicitResourcesIssuesWarning- verifies legacy resource warningstestMixedSourcesModularMainClassicTest- mixed modular/classic configurationtestSourcesMixedModulesWithinSources- mixed modules within<sources>testMultipleDirectoriesSameModule- multiple directories per moduletestDuplicateEnabledSources- duplicate detection with WARNING🤖 Generated with Claude Code