Skip to content

[MNG-7793] Add generated-source metadata to Maven 4 APIs - #12958

Open
goutamadwant wants to merge 1 commit into
apache:masterfrom
goutamadwant:feature/mng-7793-generated-source-metadata
Open

[MNG-7793] Add generated-source metadata to Maven 4 APIs#12958
goutamadwant wants to merge 1 commit into
apache:masterfrom
goutamadwant:feature/mng-7793-generated-source-metadata

Conversation

@goutamadwant

Copy link
Copy Markdown
Contributor

Fixes #9196

Summary

Add explicit generated-source metadata to Maven 4's source model and APIs so plugins can distinguish generated files without relying on directory naming conventions.

Implementation

  • Add the generated attribute to org.apache.maven.api.model.Source.
  • Expose generated state through SourceRoot.
  • Add explicit generated-source registration through ProjectManager.
  • Preserve the value through model XML, consumer POM, and legacy resource adapter paths.
  • Keep existing and legacy source registration defaulting to non-generated.
  • Preserve first-registration-wins behavior for duplicate source roots.

Verification

  • mvn --batch-mode verify
  • Focused API, implementation, and core module verification
  • XML round-trip and consumer POM coverage
  • Generated registration, duplicate registration, and legacy resource mutation coverage

Following this checklist to help us incorporate your contribution quickly and easily:

  • This pull request addresses one issue without unrelated changes.
  • The description explains what the change does, how, and why.
  • The commit has a meaningful subject and DCO sign-off.
  • Unit tests cover the behavioral changes.
  • mvn verify passes.
  • The Core IT suite has been run successfully.
  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
  • In any other case, please file an Apache Individual Contributor License Agreement.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to target Maven 4.1.0, hence the model version 4.2.0.

@goutamadwant

Copy link
Copy Markdown
Contributor Author

Thanks @gnodet. Updated the generated field to target model version 4.2.0 and moved the corresponding XML round-trip and consumer POM coverage to the 4.2.0 namespace. Let me know if this looks good now.

@slachiewicz

Copy link
Copy Markdown
Member

One more thing to address, please rebase and squash commits

@gnodet gnodet added this to the 4.1.0 milestone Aug 31, 2026
Signed-off-by: goutamadwant <workwithgoutam@gmail.com>
@goutamadwant
goutamadwant force-pushed the feature/mng-7793-generated-source-metadata branch from 496cca0 to 3bf6edd Compare September 1, 2026 03:08
@goutamadwant

goutamadwant commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@slachiewicz Rebased onto the latest master and squashed the changes into a single signed commit. Thanks for the review.!

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.

[MNG-7793] Add APIs for generated sources

3 participants