gnodet opened a new pull request, #13392:
URL: https://github.com/apache/maven/pull/13392

   ## Lifecycle execution filter (`maven.lifecycle.filter`)
   
   Adds a `-Dmaven.lifecycle.filter` user property that skips mojo executions 
matching coordinate or phase predicates at runtime.
   
   ### Predicate syntax
   
   | Form | Description | Example |
   |------|-------------|---------|
   | `*` | Skip every mojo execution | `-Dmaven.lifecycle.filter=*` |
   | `:A` | Skip by artifactId | `:maven-surefire-plugin` |
   | `G:A` | Skip by groupId:artifactId | 
`org.apache.maven.plugins:maven-enforcer-plugin` |
   | `P` | Skip by plugin prefix | `surefire` |
   | `P:v:g` | Skip by prefix + version + goal | `surefire:3.2.5:test` |
   | `P:v:g@e` | Skip by prefix + version + goal + executionId | 
`surefire::test@default-test` |
   | `phase(name)` | Skip all mojos bound to the named phase | `phase(test)` |
   
   Multiple predicates can be combined comma-separated (OR-ed): 
`-Dmaven.lifecycle.filter=phase(test),:maven-enforcer-plugin`
   
   ### Implementation
   
   - **`Constants.MAVEN_LIFECYCLE_FILTER`** — new `@Config` constant in 
`maven-api-core`
   - **`MojoExecutionFilter`** — parses the comma-separated filter expression 
into a list of `FilterPredicate`s
   - **`CoordinatePredicate`** — matches mojo executions by plugin coordinate 
or prefix
   - **`PhasePredicate`** — matches mojo executions by lifecycle phase name
   - **`FilterPredicate`** — predicate interface for extensibility
   - **`MojoExecutor`** — resolves filter predicates once per project execution 
and checks each mojo against them; skipped mojos fire a `MojoSkipped` execution 
event
   
   ### Test coverage
   
   - **Unit tests**: `CoordinatePredicateTest` (15 tests), `PhasePredicateTest` 
(5 tests), `MojoExecutionFilterTest` (11 tests) — parsing, matching, edge cases
   - **Integration tests**: `MavenITmng12535LifecycleFilterPhaseTest` (phase 
filter), `MavenITmng12536LifecycleFilterCoordinateTest` (coordinate filter by 
artifactId and prefix)
   
   ### Limitations
   
   - GroupIds without a `.` (e.g. `commons-io`) cannot be used in `G:A` form — 
they are routed to prefix-based matching. Use the `:A` form instead.
   
   Fixes https://github.com/apache/maven/issues/12535
   Fixes https://github.com/apache/maven/issues/12536
   
   ---
   
   _Hermes Agent (Claude claude-opus-4-5) 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]

Reply via email to