gnodet opened a new issue, #11399:
URL: https://github.com/apache/maven/issues/11399
## Description
When using `flatten-maven-plugin` with `updatePomFile=true` and
`<parent>expand</parent>`, Maven incorrectly detects a parent cycle during the
install phase.
## Error Message
```
Failed to execute goal
org.apache.maven.plugins:maven-install-plugin:3.1.4:install (default-install)
on project: Execution default-install of goal
org.apache.maven.plugins:maven-install-plugin:3.1.4:install failed:
org.apache.maven.api.services.ModelBuilderException: 1 problem was encountered
while building the effective model
[FATAL] The parents form a cycle: org.apache:apache:35 -> /path/to/pom.xml
-> org.apache:apache:35
```
## Reproduction
Create a POM with:
- A parent reference (e.g., `org.apache:apache:35`)
- `flatten-maven-plugin` configured with:
- `updatePomFile=true`
- `<parent>expand</parent>`
Run `mvn install` and the build fails with the cycle detection error.
## 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
Change the `PomArtifactTransformer` API to use `ModelSource` instead of
`Path`. The `ModelSource` includes the necessary context (base directory,
ModelLocator) to properly resolve parent POMs and avoid false cycle detection.
## Maven Version
Maven 4.0.x
--
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]