mariuszs opened a new issue, #11796:
URL: https://github.com/apache/maven/issues/11796

   ## 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](https://issues.apache.org/jira/browse/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
   
   1. Clone the repo
   2. `mvn install -DskipTests`
   3. Run the extension-it test project:
   
   ```bash
   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
   ```
   
   4. Check for `target/touch.txt` — it should exist but doesn't on Maven 4.
   
   The plugin's `components.xml`:
   
   ```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):
   
   ```xml
   <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


-- 
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