-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Description
When a Maven plugin registers a custom lifecycle via META-INF/plexus/components.xml with <default-phases> binding goals to standard lifecycle phases (e.g. process-sources), Maven 4 loads the custom lifecycle but does not apply the default phase bindings. The same plugin works correctly on Maven 3.
This is different from MNG-8299 which tests custom phase names invoked directly (mvn phase3). This issue is about binding plugin goals to standard default lifecycle phases via <extensions>true</extensions>.
Steps to reproduce
Minimal reproducer: https://github.com/mariuszs/extension-maven-plugin
- Clone the repo
mvn install -DskipTests- Run the extension-it test project:
cd src/it/extension-it
# substitute template variables
sed 's/@project.groupId@/com.skillpanel/;s/@project.artifactId@/extension-maven-plugin/;s/@project.version@/1.0-SNAPSHOT/' pom.xml > /tmp/test-pom.xml
mvn compile -f /tmp/test-pom.xml- Check for
target/touch.txt— it should exist but doesn't on Maven 4.
The plugin's components.xml:
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.Lifecycle</role>
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
<role-hint>extension-maven-plugin</role-hint>
<configuration>
<id>extension-maven-plugin</id>
<phases>
<phase>extension-not-used-phase</phase>
</phases>
<default-phases>
<process-sources>
com.skillpanel:extension-maven-plugin:touch
</process-sources>
</default-phases>
</configuration>
</component>
</components>
</component-set>The consuming project POM (no <executions> needed — extensions handle binding):
<plugin>
<groupId>com.skillpanel</groupId>
<artifactId>extension-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<extensions>true</extensions>
</plugin>Expected behavior
On Maven 3.9.x: the touch goal is automatically bound to process-sources phase via <default-phases>. Running mvn compile produces target/touch.txt.
[INFO] --- extension:1.0-SNAPSHOT:touch (default-touch) @ extension-it ---
Actual behavior
On Maven 4.0.0-rc-5: the custom lifecycle is loaded but <default-phases> bindings are not applied. Debug log shows:
[DEBUG] Lifecycle extension-maven-plugin -> [extension-not-used-phase]
Only the dummy phase is visible — no goal bindings to process-sources. The touch goal never executes, target/touch.txt is not created.
Environment
- Maven 4.0.0-rc-5
- Maven 3.9.13 (works correctly)
- Java 25 (also reproduced on Java 17)
- Linux