gnodet commented on issue #6918:
URL: https://github.com/apache/maven/issues/6918#issuecomment-4110474314
### Status: Still reproducible on Maven 4.1.0-SNAPSHOT
Confirmed the regression is still present. With this POM:
```xml
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>custom-clean</id>
<phase>initialize</phase>
<goals><goal>clean</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
```
Running `mvn initialize` executes `clean:clean (custom-clean)` during the
`initialize` phase, even though the plugin is only declared in
`pluginManagement` (not in `build/plugins`).
**Root cause**: `DefaultLifecycleBindingsInjector.LifecycleBindingsMerger`
(lines 128-141) merges pluginManagement config into lifecycle-default plugins
when they're newly added. This merges the pluginManagement execution (with its
custom phase) into the default clean plugin binding, effectively promoting it
to an active build execution.
The fix would need to only merge version/configuration from pluginManagement
into lifecycle defaults, not additional executions. This is a complex
behavioral change that has been a regression since Maven 3.0, so moving to
4.1.0.
_Claude Code on behalf of Guillaume Nodet_
--
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]