gnodet opened a new pull request, #11400: URL: https://github.com/apache/maven/pull/11400
## Description Fixes #11399 When using `flatten-maven-plugin` with `updatePomFile=true` and `<parent>expand</parent>`, Maven incorrectly detected a parent cycle during the install phase. The error occurred because the consumer POM builder was using `Path` instead of `ModelSource` when reading the flattened POM. ## Changes - Updated `PomArtifactTransformer.transform()` to accept `ModelSource` instead of `Path` - Modified `ConsumerPomArtifactTransformer` to create `ModelSource` with proper resolution context (base directory, ModelLocator) - Updated `DefaultConsumerPomBuilder` and related classes to work with `ModelSource` - Added integration test `MavenITgh11399FlattenPluginParentCycleTest` to verify the fix ## Root Cause The consumer POM builder was using `Path` instead of `ModelSource` when reading the flattened POM. This caused the cycle detector to incorrectly identify a cycle because it couldn't properly resolve the parent relationship context. ## Solution `ModelSource` includes the necessary context (base directory, ModelLocator) to properly resolve parent POMs and avoid false cycle detection. By providing a `ModelSource` with a proper `resolve()` implementation, the parent POM can be correctly located and the cycle detection works as expected. ## Testing - Added integration test that reproduces the issue and verifies the fix - Full build passes: `mvn install -DskipTests` - Integration test passes: `mvn test -Prun-its -Dtest=MavenITgh11399*` --- Pull Request opened by [Augment Code](https://www.augmentcode.com/) with guidance from the PR author -- 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]
