Fix IllegalArgumentException in getFolder() for ancestor resource dirs#2160
Fix IllegalArgumentException in getFolder() for ancestor resource dirs#2160chagong wants to merge 2 commits intoeclipse-m2e:mainfrom
Conversation
df14175 to
70e8b8e
Compare
|
This pull request changes some projects for the first time in this development cycle. Warning 🚧 This PR cannot be modified by maintainers because edits are disabled or it is created from an organization repository. To obtain the required changes apply the git patch manually as an additional commit. Git patchFurther information are available in Common Build Issues - Missing version increments. |
When a resource <directory> resolves to an ancestor of the project
(e.g., from a child module, or
<directory>..</directory>), projectLocation.relativize(folderPath)
produces '..'. Then project.getFolder('..') normalizes to IPath '/',
triggering IllegalArgumentException: Path must include project and
resource name: /.
Add a guard to detect when the relativized path starts with '..' and
return the project, so the caller (addResourceDirs) skips the resource
directory. This follows the same pattern as the existing
workaround.
Fixes eclipse-m2e#1790
Signed-off-by: Changyong Gong <chagon@microsoft.com>
6fda881 to
8b07819
Compare
|
@fbricon I actually undid the bump up bundle version. And by looking at the error log: Looks like it requires me to bump that version? |
|
try running "mvn clean verify -DskipTests -Dtycho.p2.baselineMode=failCommon" locally |
|
The command fails for main branch: |
|
@fbricon Looks like over 13 modules need version bumps. Do you want me to do it in this PR? |
|
@chagong can you do it in a different PR? |
Problem
When a resource
<directory>resolves to an ancestor of the project directory,AbstractJavaProjectConfigurator.getFolder()crashes with:This happens because
projectLocation.relativize(folderPath)produces.., andproject.getFolder("..")normalizes to IPath/.Affected projects
<directory>${maven.multiModuleProjectDirectory}</directory>in<resources><directory>..</directory>in a child moduleError trace
Fix
Add a guard in
getFolder(): when the relativized path starts with.., returnprojectso the caller (addResourceDirs) skips the resource directory. This follows the same pattern as the existing${basedir}workaround inaddResourceDirs()which already returns early whenr == project.Fixes #1790