apache / apache/maven-plugin-tools

[MPLUGIN-531] Fail the build if mixing v3 and v4 annotations and enforce v4 annotations when requiring Maven 4 or above

Open
#836 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
64
Forks
71
Avg merge
12h 24m
Merged PRs (30d)
32

Description

**[Konrad Windszus](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kwin)** opened **[MPLUGIN-531](https://issues.apache.org/jira/browse/MPLUGIN-531?redirect=false)** and commented

The https://github.com/apache/maven-plugin-tools/blob/master/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java should fail the build in case
v3 (1.0/1.1 descriptor, https://github.com/apache/maven-plugin-tools/tree/master/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations) and v4 (2.0 descriptor) annotations (https://github.com/apache/maven-plugin-tools/tree/master/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations) are mixed in a single project.

This leads to unexpected behaviour like `Component` no longer being evaluated among others.

Also it should not be possible to generate v2.0 descriptors with v3 annotations (currently possible via https://github.com/apache/maven-plugin-tools/blob/9332b09acc08d2e063f12a8158a57ca8ec56fadd/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorFilesGenerator.java#L114). V3 annotations should only support requirements up to (excluding) Maven 4 and v4 annotations should require Maven 4 or above. If the Maven requirements don't match the used annotation package the build should fail as well.

---

**Issue Links:**
- [MPLUGIN-530](https://issues.apache.org/jira/browse/MPLUGIN-530) Deprecate o.a.m.plugins.annotations.Component

- [MPLUGIN-523](https://issues.apache.org/jira/browse/MPLUGIN-523) Split Maven3 and Maven4 support

- [MPLUGIN-532](https://issues.apache.org/jira/browse/MPLUGIN-532) Fail the build in case JSR330 annotations are used in v4 plugins

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with JavaAnnotationsMojoDescriptorExtractor.java and PluginDescriptorFilesGenerator.java, then review the v3 and v4 annotation package paths named in the issue. Done means mixed annotation versions and mismatched Maven requirements fail the build, while v3 annotations cannot generate 2.0 descriptors and v4 annotations require Maven 4 or above.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.