Skip to content

Fix Maven 4 @Mojo descriptor attributes - #1237

Open
efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/maven4-mojo-descriptor-1231
Open

efegokdemir wants to merge 1 commit into
apache:masterfrom
efegokdemir:codex/maven4-mojo-descriptor-1231

Conversation

@efegokdemir

Copy link
Copy Markdown

Fixes #1231.

What

  • Accept the Maven 4 onlineRequired, dependencyCollection, and dependencyResolutionPathScopes annotation attributes during descriptor extraction.
  • Write path scopes to dependencyCollection when collection is requested, and to dependencyResolution otherwise.
  • Add Maven 4 integration coverage for each attribute.

Why

The annotation scanner dispatches attributes to same-named setters on MojoAnnotationContent. The missing setters made the descriptor goal fail when Maven 4 annotation attributes were explicitly set. The path scopes also need to be retained in the matching Maven 4 descriptor field.

Testing

  • Before the fix, the v4api-4x integration fixture failed during descriptor generation with Method: 'dependencyResolutionPathScopes' not found.
  • After the fix, JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home /tmp/maven4-rc7/apache-maven-4.0.0-rc-7/bin/mvn -pl maven-plugin-plugin -am -Prun-its -Dinvoker.test=v4api-4x -DskipTests verify — PASS; the Maven 4 v4api-4x integration test passed.
  • JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home /opt/homebrew/Cellar/maven/3.10.0/libexec/bin/mvn -pl maven-plugin-tools-annotations -am test — PASS; 98 tests, no failures or errors.
  • git diff --cached --check — PASS.

Notes

AI assistance was used during preparation; the submitting contributor reviewed the changes and test results.


  • I hereby declare this contribution to be licensed under the Apache License Version 2.0 (January 2004).
  • I hereby declare that I have filed an Apache Individual Contributor License Agreement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

descriptor fails on onlineRequired, dependencyCollection and dependencyResolutionPathScopes in the Maven 4 API @Mojo

1 participant