gnodet opened a new pull request, #12740:
URL: https://github.com/apache/maven/pull/12740

   ## Summary
   
   - Catch `InvalidPathException` in `BuildPathSource.resolve()` (new API) and 
`FileModelSource.getRelatedSource()` (compat) and return `null`, letting the 
caller fall through to repository-based parent resolution
   - Adds tests for both code paths
   
   ## Problem
   
   Some POMs on Maven Central have `<relativePath>` set to a GAV coordinate 
instead of a filesystem path. For example, 
[`artemis-project-2.33.0.pom`](https://repo.maven.apache.org/maven2/org/apache/activemq/artemis-project/2.33.0/artemis-project-2.33.0.pom)
 contains:
   
   ```xml
   <relativePath>org.apache:apache</relativePath>
   ```
   
   On Windows, colons are reserved for drive letters, so 
`Path.resolve("org.apache:apache")` throws `InvalidPathException` before any 
file-existence check can run. On Linux/macOS the same call succeeds (`:` is 
valid in paths), and the subsequent `Files.isRegularFile()` check returns 
`false`, so the invalid path is harmlessly ignored.
   
   ## Approach
   
   Catch `InvalidPathException` and return `null` — an invalid path obviously 
cannot point to an existing parent POM, so returning `null` is the correct 
semantic (no local parent found → fall through to repository resolution). This 
matches Maven 3.x behavior.
   
   Closes #12738
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to