Fix Source targetPath incorrectly aligned to project basedir#12178
Open
gnodet wants to merge 3 commits into
Open
Fix Source targetPath incorrectly aligned to project basedir#12178gnodet wants to merge 3 commits into
gnodet wants to merge 3 commits into
Conversation
DefaultModelPathTranslator.alignToBaseDirectory(Source) was resolving Source.targetPath against the project basedir, turning a relative path like ".grammar" into an absolute path like "/path/to/project/.grammar". This caused the maven-resources-plugin to write files to incorrect absolute locations instead of relative to the output directory (target/classes). The targetPath should remain relative to the output directory, matching the behavior documented in maven.mdo and consistent with how Resource.targetPath is handled (not aligned to basedir). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
added a commit
that referenced
this pull request
May 28, 2026
Cherry-pick from fix/resource-targetpath branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use Path.endsWith(Path) instead of String.endsWith(String) to handle both / and \ separators cross-platform. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
DefaultModelPathTranslator.alignToBaseDirectory(Source)was incorrectly resolvingSource.targetPathagainst the project basedir, turning a relative path like.grammarinto an absolute path like/path/to/project/.grammartarget/classes)Sourcepath translation, matching the existing behavior forResource.targetPath(which is correctly not aligned)Test plan
DefaultModelPathTranslatorTest— verifies Source targetPath is NOT aligned while directory IS alignedProjectBuilderTest#testSourceTargetPathRemainsRelative— full model builder integration test with.grammarandMETA-INF/testtargetPaths, verifying both SourceRoot API and compat Resource APIPomConstructionTest#testTargetPathResourceRegression— still passesResourceIncludeTest(10 tests) — still passesDefaultSourceRootTest(13 tests) — still passesmaven-implandmaven-core(547 tests) — all passClaude Code on behalf of Guillaume Nodet
🤖 Generated with Claude Code