gnodet opened a new issue, #12534:
URL: https://github.com/apache/maven/issues/12534
## Summary
The `@After` annotation (`org.apache.maven.api.plugin.annotations.After`,
`@since 4.0.0`, `@Experimental`) exists in `maven-api-core` and the underlying
`Lifecycle.Link`/`Pointer` model is already used internally by
`DefaultLifecycleRegistry` to define the tree-based lifecycle. However, **there
is no processing pipeline that makes `@After` usable by plugin authors** — it
compiles but has zero runtime effect.
## Missing pieces
### 1. Plugin descriptor model (`plugin.mdo`)
`MojoDescriptor` has no fields for after/link/pointer. Needs new elements to
represent the ordering constraints declared by `@After`.
### 2. maven-plugin-tools annotation scanner
The annotation processor that generates `META-INF/maven/plugin.xml` from
`@Mojo`/`@Parameter` annotations **does not read `@After` at all**. Needs to
extract `phase()`, `type()`, and `scope()` from `@After` annotations on mojo
classes and emit them into the descriptor.
### 3. Maven core plugin executor
Needs to read the new descriptor fields and create proper `Lifecycle.Link`
entries (`Kind.AFTER` with the appropriate `Pointer` subtype) when loading
plugin descriptors, so the concurrent builder can schedule mojos correctly.
## Context
The internal lifecycle definition already uses the exact same model:
```java
// DefaultLifecycleRegistry.java
phase(COMPILE, after(SOURCES), dependencies(SCOPE_COMPILE, READY)),
phase(READY, after(COMPILE), after(RESOURCES)),
phase(TEST_COMPILE, after(TEST_SOURCES), after(READY),
dependencies(SCOPE_TEST_ONLY, READY)),
```
The intent of `@After` is to let plugin mojos declare the same ordering
constraints:
```java
@After(phase = "compile", type = After.Type.PROJECT)
@After(phase = "ready", type = After.Type.DEPENDENCIES, scope = "compile")
@Mojo(name = "my-goal")
public class MyMojo implements Mojo { ... }
```
This would be particularly powerful with the concurrent builder — a mojo
could express precise ordering constraints without being pinned to a single
fixed phase.
## Relevant source files
- `After.java` — `maven-api-core` annotation definition
- `Lifecycle.java` — `Link`, `Pointer`, `PhasePointer`,
`DependenciesPointer`, `ChildrenPointer`
- `Lifecycles.java` — `after()`, `dependencies()`, `children()` helper
methods
- `DefaultLifecycleRegistry.java` — tree-based lifecycle definition using
those helpers
- `plugin.mdo` — plugin descriptor model (in maven-plugin-tools)
No plugin currently uses `@After` — searched all major Apache Maven plugins
(compiler, surefire, dependency, javadoc, resources, jar, install, deploy,
site, clean, shade, assembly, war, ear, enforcer).
--
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]