Fail on legacy config in modular projects#11702
Fail on legacy config in modular projects#11702ascheman wants to merge 1 commit intoapache:masterfrom
Conversation
In modular projects, legacy directories and resources that would be silently ignored now trigger an ERROR instead of WARNING: - Explicit <sourceDirectory>/<testSourceDirectory> differing from defaults - Default src/main/java or src/test/java existing on filesystem - Explicit <resources>/<testResources> differing from Super POM defaults This prevents silent loss of user-configured sources/resources. AC8 supersedes AC7 which originally used WARNING. Fixes apache#11701 See apache#11701 (comment) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
70a7358 to
c1b431b
Compare
|
Reviews are welcome, in particular from @elharo and @desruisseaux - thanks! |
elharo
left a comment
There was a problem hiding this comment.
not obvious to me how claude code is being used here. Generally I would not expect simply pointing it at this issue without human editing to produce correct results.
| * | ||
| * Additionally, for modular projects, legacy directories are unconditionally | ||
| * ignored because it is not clear how to dispatch their content between | ||
| * rejected because it is not clear how to dispatch their content between |
There was a problem hiding this comment.
I don't think this is what we were looking for. The build fails completely, not simply a warning
There was a problem hiding this comment.
Proposal: replace "A warning is emitted if …" by "The build fails if …".
| * </ul> | ||
| * Legacy directories are unconditionally ignored in modular projects because it is not clear | ||
| * how to dispatch their content between different modules. | ||
| * In both cases, the legacy directory conflicts with modular sources and must not be used. |
There was a problem hiding this comment.
not "and must not be used" but rather the complete build fails.
There was a problem hiding this comment.
not "and must not be used" but rather the complete build fails.
Isn't what the next line below is saying?
| scopeId, | ||
| sourcesConfig); | ||
| String message = String.format( | ||
| "Legacy %s element must not be used because %s resources are configured via %s in <sources>.", |
There was a problem hiding this comment.
must not be used --> cannot be used in modular projects
| if (hasExplicitLegacyResources(resources, scopeId)) { | ||
| String message = "Legacy " + legacyElement | ||
| + " element is ignored because modular sources are configured. " | ||
| + " element must not be used because modular sources are configured. " |
| scopeId, | ||
| sourcesConfig); | ||
| String message = String.format( | ||
| "Legacy %s element must not be used because %s resources are configured via %s in <sources>.", |
| * Acceptance Criterion: AC2 (unified source tracking for all lang/scope combinations) | ||
| * Acceptance Criteria: | ||
| * - AC2 (unified source tracking for all lang/scope combinations) | ||
| * - AC8 (legacy directories error - supersedes AC7 which originally used WARNING) |
There was a problem hiding this comment.
not sure how the AC are being used, but shouldn't AC7 be changed rather than superseded?
| * In modular projects, legacy directories are unconditionally ignored because it is not clear | ||
| * how to dispatch their content between different modules. A warning is emitted if these | ||
| * properties are explicitly set (differ from Super POM defaults). | ||
| * In modular projects, legacy directories must not occur because it is not clear |
There was a problem hiding this comment.
In modular projects, legacy directories must not occur --> Legacy directories cannot be used in modular projects
Summary
Affected configurations in modular projects:
<sourceDirectory>/<testSourceDirectory>differing from defaultssrc/main/javaorsrc/test/javaexisting on filesystem<resources>/<testResources>differing from Super POM defaultsTest plan
ProjectBuilderTest#testModularSourcesWithExplicitResourcesIssuesErrorpassesProjectBuilderTest#testMixedSourcesModularMainClassicTestpassesFixes #11701
See #11701 (comment)
🤖 Generated with Claude Code