GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feat: Add id attribute (gav) support to Dependency, Exclusion, Mixin by rbygrave · Pull Request #11904 · apache/maven

Conversation

@rbygrave

@rbygrave rbygrave commented Apr 8, 2026 •
edited by gnodet
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Based on design discussion on Issue #11500, the proposal is to support a compact id attribute format for Dependency, Exclusion and Mixin elements.

Dependency id Format

The id attribute supports the following compact formats, using the standard Maven coordinate order (groupId:artifactId:type:classifier:version):

Format Description
groupId:artifactId version managed via <dependencyManagement>
groupId:artifactId:version explicit version
groupId:artifactId:type:version with explicit type
groupId:artifactId:type:classifier:version with type and classifier

Full syntax: groupId:artifactId[[:type[:classifier]]:version][@scope][?]

A trailing : (empty version) indicates the version is managed (e.g. groupId:artifactId:type:).

Any segment may be left empty to skip setting that field, leaving it for later inference (e.g. from dependencyManagement). For example, :artifactId leaves groupId unset, and :artifactId:version leaves groupId unset with an explicit version.

An optional @scope suffix sets the dependency scope (test, provided, runtime, compile, system, import). A trailing ? marks the dependency as optional.

Examples

<!-- Basic GAV -->
<dependency id="org.slf4j:slf4j-api:2.0.17"/>

<!-- Managed version (from dependencyManagement) -->
<dependency id="org.slf4j:slf4j-api"/>

<!-- Inferred groupId (from dependencyManagement) -->
<dependency id=":slf4j-api"/>

<!-- Inferred groupId with explicit version -->
<dependency id=":slf4j-api:2.0.17"/>

<!-- With scope -->
<dependency id="org.junit.jupiter:junit-jupiter-api:5.14.1@test"/>

<!-- Inferred groupId with scope -->
<dependency id=":junit-jupiter-api@test"/>

<!-- With optional marker -->
<dependency id="commons-io:commons-io:2.11.0?"/>

<!-- Scope + optional combined -->
<dependency id="org.apache.maven:maven-core:3.9.0@provided?"/>

<!-- Import scope (for BOMs) -->
<dependency id="org.junit:junit-bom:5.12.0@import"/>

<!-- With type -->
<dependency id="org.example:lib-b:pom:1.0"/>

<!-- With type and classifier -->
<dependency id="org.example:lib-c:jar:sources:1.0"/>

<!-- Type with managed version -->
<dependency id="org.example:lib-b:pom:"/>

<!-- Exclusions with id attribute -->
<dependency id="org.postgresql:postgresql:42.7.3">
  <exclusions>
    <exclusion id="*:*"/>
  </exclusions>
</dependency>

<!-- Mixin with compact format -->
<mixin id="com.example.mixins:java-mixin:1.0.0"/>

Validation

  • When id is used, child elements groupId, artifactId, and version must not be specified (even if the corresponding segment in the id is empty).
  • type conflict is only checked when the id has 4+ parts (3+ colons, i.e. type is encoded).
  • classifier conflict is only checked when the id has 5 parts (4 colons, i.e. classifier is encoded).
  • When @scope is present in the id, a <scope> child element must not be specified.
  • When ? is present, an <optional> child element must not be specified.
  • Scope and optional can still be specified as child elements when not encoded in the id attribute.

Inference

Empty segments are skipped during normalization, leaving the corresponding field unset for later inference. This allows patterns like:

  • :artifactId — groupId and version left unset for inference from dependencyManagement
  • :artifactId:version — groupId left unset
  • groupId:artifactId:type: — version left unset (managed), type explicit

Notes

  • Mixin has the XML attribute id but uses gav underneath as the Java field, to work around a name clash with getId() from Parent.
  • Normalization splits the id into component fields and clears the id attribute, so downstream code works with standard dependency fields.
  • Existing child element values are not overridden — the id attribute only fills in fields that are currently null/empty.

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

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

  • I hereby declare this contribution to be licensed under the Apache License Version 2.0, January 2004
  • In any other case, please file an Apache Individual Contributor License Agreement.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rbygrave
rbygrave commented Apr 8, 2026
View reviewed changes
Comment thread api/maven-api-model/src/main/mdo/maven.mdo Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet
gnodet reviewed May 21, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Claude Code on behalf of Guillaume Nodet

Overall a clean implementation. The strict validation, test coverage, and the Mixin gav field workaround are well thought out. A few issues to address:

  1. Dependency management dependencies are not expanded -- mergeDuplicates only expands id on model.getDependencies() but not on model.getDependencyManagement().getDependencies(), nor on profile-scoped dependencies/dependency-management. The validator correctly validates all of these (lines 536-596 of DefaultModelValidator), so managed deps with id will pass validation but never get expanded.

  2. Normalization runs after raw validation -- validateRawModel runs in doReadRawModel() (line 1818) before mergeDuplicates (line 1362 in readInputModel). The validator's duplicate-detection key logic (using dependency.getId() directly when set) handles this correctly, but it means the validator sees the unexpanded state. This is fine for the conflict checks but worth keeping in mind.

  3. Dependency.getId() naming clash -- The Dependency class now has a new id field with getId()/setId() via the model generator. But Parent (and therefore Mixin) has a computed getId() method in a codeSegment that returns groupId:artifactId:pom:version. Since Mixin extends Parent, the new field was wisely renamed to gav. However, does Dependency have a similar computed getId() method anywhere? If so, the new id field's generated getter could shadow or conflict with it. Worth verifying the generated code compiles cleanly.

  4. isBlank does not trim -- The isBlank helper in the normalizer only checks for null/empty, not for whitespace-only strings. The name isBlank is misleading since String.isBlank() checks whitespace. Consider renaming to isNullOrEmpty or using String.isBlank() which handles whitespace in coordinates (e.g., " ").

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelNormalizer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelNormalizer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelNormalizer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gnodet gnodet added this to the 4.1.0 milestone Jun 16, 2026
@gnodet gnodet added mvn4 enhancement New feature or request labels Jun 22, 2026
gnodet added a commit that referenced this pull request Jun 23, 2026
@gnodet @claude
[GH-11904] Support managed-version formats in dependency id attribute
3d4ddbe
Add support for 2-part `g:a` format and trailing-colon formats
(`g:a:`, `g:a:type:`, `g:a:type:classifier:`) for dependencies
whose version is provided by dependencyManagement. The trailing
colon convention signals that version is managed, not missing.

Leave aside inferred ids (`:a:` with inferred groupId) for now.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
gnodet added a commit to rbygrave/maven that referenced this pull request Jun 24, 2026
@gnodet @claude
[apacheGH-11904] Add dependency id attribute support for Maven 4.2.0
5a8fcdb
Add compact `id` XML attribute to Dependency, Exclusion, and Mixin
elements in the Maven model (4.2.0+). Supported formats:
- Dependency: g:a:v, g:a:type:v, g:a:type:classifier:v
- Exclusion: g:a
- Mixin (as `gav`/`id`): g:a:v

The normalizer expands `id` into individual fields and clears it so
consumer POMs never contain the attribute. Uses forceCopy=true in
builders to ensure `id(null)` actually clears the field.

Includes comprehensive unit tests (normalizer, validator), consumer
POM transformation tests, and integration test verifying no id
attributes leak into deployed POMs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
gnodet added a commit to rbygrave/maven that referenced this pull request Jun 24, 2026
@gnodet @claude
[apacheGH-11904] Add mvnup strategy to collapse dependencies into id …
e83a24f
…attributes

Add DependencyIdStrategy that migrates verbose dependency/exclusion
child elements into compact `id` attributes when upgrading to model
version 4.2.0 via mvnup.

The strategy runs at @priority(25), after InferenceStrategy (30), so
only dependencies that still have full explicit coordinates after
inference are collapsed. Triggered by --model-version 4.2.0 or --all.

Supported transformations:
- <dependency> g:a:v / g:a:type:v / g:a:type:classifier:v
- <exclusion> g:a
- Processes all sections: dependencies, dependencyManagement, profiles,
  plugin dependencies

Inferred ids (partial coordinates like `:a` or `g:a` without version)
are intentionally not supported — the `id` attribute is a shorthand
for explicit coordinates, not a replacement for Maven's inference
mechanism. Dependencies with missing coordinates after inference are
left in their expanded form.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
gnodet added a commit to rbygrave/maven that referenced this pull request Jun 24, 2026
@gnodet @claude
Merge branch 'feature/apachegh-11904-dependency-id-attribute' into fe…
60dde52
…ature/dependency-id-attribute

Combines type/classifier/managed-version support with @scope/? optional
markers in the dependency id attribute compact syntax.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
gnodet
gnodet reviewed Jul 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Review of this large PR (3100+ lines, 42 files) adding compact id attribute syntax for Dependency, Exclusion, and Mixin elements in Maven 4.2.0.

Confirmed finding:

  1. CI broken — integration test compilation error (high): MavenITgh11904DependencyIdAttributeTest at line 44 calls super("[4.0.0-rc-3-SNAPSHOT,)") but AbstractMavenIntegrationTestCase only has a no-arg constructor. All 9 integration-test CI jobs fail with this compilation error. The fix is straightforward — use the no-arg super call. This is likely due to the PR branch being stale relative to recent changes in the AbstractMavenIntegrationTestCase base class.

Previous review feedback addressed:

  • dependencyManagement and profile dependencies are now expanded ✅
  • isBlank renamed to isNullOrEmpty ✅

Positive observations:

  • Test coverage is strong: unit tests for the normalizer (577 lines), validator (~150 new lines with 26 validation XML files), consumer POM transformation test, integration test, StAX reader tests, and mvnup strategy tests (967 lines)
  • The forceCopy=true parameter in builders is correctly used to ensure id(null) clears the field rather than being treated as "no change"
  • The PR is large but the scope is well-defined and cohesive — splitting would risk inconsistent intermediate states
  • The core feature (compact id attribute) is well-designed and consistent with XML attribute conventions

Findings dropped after verification (6 false positives):

  • Scope/optional asymmetry in DependencyIdStrategy: intentional design, explicitly tested
  • Dedup key format mismatch: validator prohibits mixing id and expanded forms
  • Dead code in switch default: defensive coding practice
  • Duplicate isNullOrEmpty helpers: trivially private, not worth extracting
  • Mixin gav/id naming: documented Modello convention
  • Invalid id persisting through normalization: intentional for validator to catch

The main blocker is the CI compilation error — once that's fixed, the PR looks ready for a closer look at merge readiness.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet previously requested changes Jul 24, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-structured PR adding compact id attribute support for Dependency, Exclusion, and Mixin. The normalizer, validator, and mvnup strategy changes are sound. However, the integration test has a compilation error that breaks all 9 CI integration-test jobs.

All findings independently verified (4/4 confirmed):

  1. IT compilation error (high) — MavenITgh11904DependencyIdAttributeTest calls super("[4.0.0-rc-3-SNAPSHOT,)") but AbstractMavenIntegrationTestCase only has a no-arg constructor (the String constructor was removed in commit be9541cb9d). CI logs confirm all 9 integration-test jobs fail.
  2. Missing mixin validation tests (medium) — ~48 lines of mixin id/gav validation logic (format check, child element conflicts) are added to DefaultModelValidator but DefaultModelValidatorTest has no mixin-related test cases. The normalizer and parser tests cover expansion/parsing, but validator error paths are untested.
  3. Dedup key inconsistency (medium, low impact) — With id set, the dedup key includes version (g:a:1.0); without id, the key is getManagementKey() (no version). Practical impact is low since the normalizer properly deduplicates after expansion.
  4. Duplicate isNullOrEmpty (low) — Identical private methods in DefaultModelNormalizer and DefaultModelValidator. Trivial; noted for completeness.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...core-it-suite/src/test/java/org/apache/maven/it/MavenITgh11904DependencyIdAttributeTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet
gnodet reviewed Sep 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fix pushed: commit 1cd2408a68 addresses the MavenITmng4403LenientDependencyPomParsingTest regression.

Root cause: expandAndDeduplicateDependencies was applied to dependencyManagement sections, inadvertently deduplicating them. The MNG-4403 test relies on Maven tolerating duplicate <dependency> declarations in dependencyManagement of dependency POMs (MNG-4005 lenient parsing). The deduplication of getDependencies() is a backward-compat behavior inherited from Maven 2.x, but it was never applied to dependencyManagement.

Fix: extracted a dedicated expandDependencyIds() method that only expands id attributes without deduplication, and uses it for dependencyManagement and profile dependencyManagement sections. The expandAndDeduplicateDependencies method is now only used for model.getDependencies() as before.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet reviewed Sep 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after latest push (commits f585904284 and 1cd2408a68).

Previous findings status:

  1. ✅ IT compilation error — fixed (no-arg constructor in f585904284)
  2. ⚠️ Missing mixin validation tests — still no test coverage for the ~48 lines of mixin id/gav validation in DefaultModelValidator (format check, child element conflicts at lines 376-428). Not a blocker but a gap.
  3. ℹ️ Dedup key inconsistency — acknowledged, low impact
  4. ℹ️ Duplicate isNullOrEmpty — now in 3 files (normalizer, validator, consumer POM builder)

New findings from latest push:

Confirmed (1/1):

  1. Type-check divergence between normalizer and consumer POM builder (medium) — DefaultModelNormalizer.expandDependencyId() uses isNullOrEmptyOrDefault(d.getType()) for the type field in 4-part and 5-part ids (treating "jar" as empty/default), but the duplicated code in DefaultConsumerPomBuilder.expandSingleDependencyId() uses plain isNullOrEmpty(d.getType()). This means the consumer POM builder won't set the type from id if the dependency already has type="jar" explicitly set — while the normalizer would. In practice this is likely harmless (jar is the default), but it's a subtle behavioral difference between two implementations that are supposed to mirror each other. Worth harmonizing.

Observation (not blocking):

The ~190 lines of id expansion logic in DefaultConsumerPomBuilder is a near-verbatim copy of the normalizer's code. This is intentional (the consumer POM builder operates on an already-built model and needs its own expansion path), but it creates a maintenance risk: any future change to the id syntax parsing needs to be applied in two places. A shared utility method or a static helper class could reduce this. Not blocking for this PR, but worth considering for follow-up.

Latest fix assessment:

Commit 1cd2408a68 correctly separates expandDependencyIds() (id expansion only) from expandAndDeduplicateDependencies() (id expansion + deduplication). The deduplication is a Maven 2.x compat behavior that only applies to model.getDependencies(), not to dependencyManagement. The fix is clean and well-scoped — the MavenITmng4403LenientDependencyPomParsingTest regression is addressed.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...e/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet
gnodet reviewed Sep 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Review of the latest state (commits 153b6c49e3 through 1cd2408a68) — signal PUSHED.

All PR-specific unit tests pass locally:

  • DefaultModelNormalizerTest: 37/37 ✅
  • DefaultModelValidatorTest: 107/107 ✅
  • MavenStaxReaderTest: 14/14 ✅
  • ConsumerPomArtifactTransformerTest: 11/11 ✅
  • DependencyIdStrategyTest: 35/35 ✅

Previous review findings resolved:

  1. IT compilation error — Fixed: no-arg constructor ✅
  2. dependencyManagement deduplication — Fixed in 1cd2408a68: extracted expandDependencyIds() that only expands id attributes without deduplication. expandAndDeduplicateDependencies now only applies to model.getDependencies() ✅

Confirmed findings (1 medium, 2 low):

1. Type check inconsistency between normalizer and consumer POM builder (medium)

The normalizer's expandDependencyId uses isNullOrEmptyOrDefault(d.getType()) (accepts null, "", or "jar") when deciding whether to set the type from the id attribute. The consumer POM builder's expandSingleDependencyId uses isNullOrEmpty(d.getType()) instead — it won't overwrite a default "jar" type.

This means a dependency with <type>jar</type> as a child element and id="g:a:war:1.0" would be expanded differently by the normalizer vs the consumer POM builder. In practice, the validator catches conflicts before the consumer POM builder runs, so this is more of a consistency issue than a bug. But the consumer POM builder copy should use isNullOrEmptyOrDefault to match the normalizer, since the two are meant to implement the same expansion logic.

DefaultModelNormalizer.java line 264:

if (!parts[2].isEmpty() && isNullOrEmptyOrDefault(d.getType())) {

DefaultConsumerPomBuilder.java line 937:

if (!parts[2].isEmpty() && isNullOrEmpty(d.getType())) {

2. ~150 lines of duplicated expansion logic (low)

The expandSingleDependencyId, expandDependencyIdList, expandExclusionIdList, and isNullOrEmpty methods are nearly identical copy-paste between DefaultModelNormalizer and DefaultConsumerPomBuilder. This is a maintenance risk — the type check inconsistency above is a direct consequence of this duplication. Consider extracting to a shared utility class, or having the consumer POM builder delegate to the normalizer.

3. Missing mixin validation tests (low)

Still unfixed from the previous review. ~48 lines of mixin id/gav validation logic (format check + child element conflict) in DefaultModelValidator have no corresponding test cases in DefaultModelValidatorTest. The normalizer and parser tests cover expansion/parsing, but the validator error paths for malformed mixin id attributes remain untested.

Findings dropped after verification:

  • Dedup key inconsistency in validator (noted in prior reviews, low impact, validator prevents the pathological case)
  • expandAndDeduplicateDependencies null return contract — the callers handle it correctly

Overall, the PR is in good shape. The dedup regression fix is clean and well-scoped. The main actionable item is the type check inconsistency (#1) which is a straightforward fix.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet

gnodet commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fix pushed in 4632bb8c13: harmonized type-check in consumer POM builder to use isNullOrEmptyOrDefault() matching the normalizer, as flagged in the review.

Also addresses the observation about duplicated isNullOrEmpty — the consumer POM builder now has its own isNullOrEmptyOrDefault() private helper, consistent with the normalizer's approach.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gnodet
gnodet dismissed their stale review September 9, 2026 22:37

All findings from this review have been addressed in subsequent commits. IT compilation error fixed, dependencyManagement dedup regression fixed, type-check inconsistency fixed.

gnodet
gnodet reviewed Sep 9, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 4632bb8c13 — signal PUSHED.

All PR-specific unit tests pass locally:

  • DefaultModelNormalizerTest + DefaultModelValidatorTest: ✅
  • ConsumerPomArtifactTransformerTest: ✅
  • DependencyIdStrategyTest: ✅
  • MavenStaxReaderTest: ✅

Previous finding resolved:

  1. Type check inconsistency between normalizer and consumer POM builder — Fixed in 4632bb8c13: both now use isNullOrEmptyOrDefault(d.getType()) for type fields in 4-part and 5-part ids. The expansion logic in DefaultConsumerPomBuilder.expandSingleDependencyId() and DefaultModelNormalizer.expandDependencyId() is now fully aligned. ✅

Remaining findings (2 low):

1. Missing mixin validation tests (low)

~48 lines of mixin id/gav validation logic in DefaultModelValidator (lines 378-424: format check requiring exactly 3 parts, and child element conflict checks for groupId, artifactId, version) have no corresponding test cases. The normalizer and StAX reader tests cover expansion/parsing, but the validator error paths for malformed mixin id attributes remain untested. Not a blocker, but a test coverage gap.

2. Duplicated expansion logic across normalizer and consumer POM builder (low)

~150 lines of id expansion logic (expandSingleDependencyId, expandDependencyIdList, expandExclusionIdList, isNullOrEmpty, isNullOrEmptyOrDefault) are near-verbatim duplicated between DefaultModelNormalizer and DefaultConsumerPomBuilder. The type-check inconsistency fixed in this commit was a direct consequence of this duplication. A shared utility class or static helper could prevent future drift. Not blocking for this PR, but worth a follow-up.

Branch status: 6 commits behind master, clean merge (no conflicts).

Overall the PR is in good shape — the main actionable finding from the previous review has been addressed. The remaining items are low-priority improvements.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet-bot
gnodet-bot approved these changes Sep 10, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 4632bb8c — the type-check inconsistency between normalizer and consumer POM builder is fixed.

Previous finding resolved:

  1. Type check inconsistency — Both case 4 and case 5 in DefaultConsumerPomBuilder.expandSingleDependencyId() now use isNullOrEmptyOrDefault(d.getType()), matching DefaultModelNormalizer.expandDependencyId(). The missing isNullOrEmptyOrDefault helper is added. ✅

Remaining (low, not blocking):

  • ~150 lines of duplicated expansion logic across normalizer and consumer POM builder — maintenance risk, but not blocking for this PR.
  • ~48 lines of mixin id/gav validation logic in DefaultModelValidator have no corresponding test cases — not blocking.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet-bot
gnodet-bot approved these changes Sep 24, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 42ca2ddd — docs only: EXPECT comments added to validation test XML fixtures.

No behavior change. Previous approval stands. All unit tests and ITs pass (CI green).

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet gnodet mentioned this pull request Oct 14, 2026
Lifecycle execution filter (maven.lifecycle.filter) #13392
Merged
@github-actions

This comment has been minimized.

Sign in to view
@gnodet

gnodet commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

The license-declaration CI check is failing because of a typo in the PR description.

The description currently reads:

- [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)

The check requires the exact text "licensed" (not "licenced"). Please edit the PR description and change licenced → licensed on that line to unblock CI.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gnodet
gnodet requested review from Bukama, ascheman, cstamas, hboutemy, rmannibucau, slachiewicz and slawekjaranowski October 14, 2026 22:47
gnodet
gnodet approved these changes Oct 14, 2026
View reviewed changes
@rmannibucau

rmannibucau commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

A few note - don't take them all as a "no" but more as what was my expectations on this topic:

  • groupId:artifactId:type:classifier:version
  • no need of trailing ":" hack, a managed version has no version tag so not an issue
  • i wouldnt collapse scope at all, it is harder to read, misleading and not the identity of the dependency at all
  • why would exclusions not be inlined?
  • never infer groupId, can only lead to issues
  • must include extensions, plugins, etc... too

more generally speaking not collapsing anything but keeping 1 value per "field" sounds saner on the long run (ivy style) cause it doesn't imply to create a custom language in another language (xml) which is saner and more tool friendly (i know xslt 3 enables crazy things but let's not need it).

Will also solve the groupId:artifactId:type:classifier:version order definition which is very misleading, not normalized and generally enforces to type more info than needed.

So overall I would just move children as attributes and drop the inference for groupId.

That's the best outcome I went with this topic over the last years of discussion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cstamas
cstamas requested a balanced review from Copilot October 20, 2026 18:56
Copilot AI reviewed Oct 20, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

9 open issues
  • High severity Using stripScopeAndOptional(id) as the deduplication key changes semantics compared to… · New
  • High severity The conflict checks for <type> and <classifier> rely only on colon count, which incorrectly… · New
  • Medium severity The class-level Javadoc says this strategy applies to “model version 4.2.0 or higher”, but… · New
  • Medium severity The class-level Javadoc says this strategy applies to “model version 4.2.0 or higher”, but… · New
  • Medium severity The class-level Javadoc says this strategy applies to “model version 4.2.0 or higher”, but… · New
  • Medium severity The consumer-POM expansion logic duplicates the expansion rules already implemented in… · New
  • Medium severity The consumer-POM expansion logic duplicates the expansion rules already implemented in… · New
  • Medium severity Mixins currently only validate the number of : segments, but accept empty segments such as… · New
  • Medium severity The exclusion id validator only checks colonCount == 1, which allows invalid values like… · New
What changed in this PR

Adds support for compact id (GAV-style) attributes on Dependency, Exclusion, and Mixin model elements, including validation, normalization (expansion into standard fields), and coverage via unit + integration tests.

Changes:

  • Extend the model (MDO) to add id attributes for dependencies/exclusions and id (mapped to gav) for mixins.
  • Implement validation + normalization logic to expand id/gav into component fields and clear the attribute afterward.
  • Add unit tests, consumer-POM transform coverage, and an IT project verifying id does not leak into produced consumer POMs.
File Description
its/​core-it-suite/​src/​test/​resources/​gh-11904-dependency-id-attribute/​pom.xml Adds IT reactor parent for the dependency-id scenario.
its/​core-it-suite/​src/​test/​resources/​gh-11904-dependency-id-attribute/​lib-a/​pom.xml Adds IT module used as a dependency target.
its/​core-it-suite/​src/​test/​resources/​gh-11904-dependency-id-attribute/​child/​src/​main/​java/​Test.java Minimal Java source to make the child module buildable.
its/​core-it-suite/​src/​test/​resources/​gh-11904-dependency-id-attribute/​child/​pom.xml Uses <dependency id="..."/> in an IT module.
its/​core-it-suite/​src/​test/​java/​org/​apache/​maven/​it/​MavenITgh11904DependencyIdAttributeTest.java IT that asserts consumer POM output contains expanded fields and no id= attrs.
impl/​maven-support/​src/​test/​java/​org/​apache/​maven/​model/​v4/​MavenStaxReaderTest.java Parser-level tests ensuring id/gav attributes are read into the model.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​exclusion-id-valid.xml Validator fixture for a valid exclusion id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​exclusion-id-conflict-multiple.xml Validator fixture for exclusion id conflicting with child fields.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​exclusion-id-conflict-groupId.xml Validator fixture for exclusion id conflicting with <groupId>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​exclusion-id-conflict-artifactId.xml Validator fixture for exclusion id conflicting with <artifactId>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​exclusion-id-bad-format.xml Validator fixture for bad exclusion id format.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-with-scope-valid.xml Validator fixture for @scope in dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-with-scope-optional-valid.xml Validator fixture for combined @scope? in dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-with-optional-valid.xml Validator fixture for ? optional marker in dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-valid.xml Validator fixture for valid dependency id forms.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-trailing-colon-5parts-valid.xml Validator fixture for managed version with 5-part id and trailing colon.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-trailing-colon-4parts-valid.xml Validator fixture for managed version with 4-part id and trailing colon.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-trailing-colon-3parts-valid.xml Validator fixture for managed version with 3-part id and trailing colon.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-scope-conflict.xml Validator fixture for @scope in id conflicting with <scope>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-optional-conflict.xml Validator fixture for ? in id conflicting with <optional>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-conflict-version.xml Validator fixture for id conflicting with <version>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-conflict-type.xml Validator fixture for id encoding type conflicting with <type>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-conflict-multiple.xml Validator fixture for id conflicting with multiple child fields.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-conflict-groupId.xml Validator fixture for id conflicting with <groupId>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-conflict-artifactId.xml Validator fixture for id conflicting with <artifactId>.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-bad-format.xml Validator fixture for bad dependency id format.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-5parts-valid.xml Validator fixture for 5-part dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-4parts-valid.xml Validator fixture for 4-part dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-3parts-valid.xml Validator fixture for 3-part dependency id.
impl/​maven-impl/​src/​test/​resources/​poms/​validation/​dependency-id-2parts-valid.xml Validator fixture for 2-part dependency id.
impl/​maven-impl/​src/​test/​java/​org/​apache/​maven/​impl/​model/​DefaultModelValidatorTest.java Adds validator tests for dependency + exclusion id rules.
impl/​maven-impl/​src/​test/​java/​org/​apache/​maven/​impl/​model/​DefaultModelNormalizerTest.java Adds extensive normalization tests for expansion + inference + scope/optional.
impl/​maven-impl/​src/​main/​java/​org/​apache/​maven/​impl/​model/​DefaultModelValidator.java Implements validation for dependency/exclusion id and mixin gav, plus raw dedup key handling.
impl/​maven-impl/​src/​main/​java/​org/​apache/​maven/​impl/​model/​DefaultModelObjectPool.java Updates pooling equality/hash to consider dependency id.
impl/​maven-impl/​src/​main/​java/​org/​apache/​maven/​impl/​model/​DefaultModelNormalizer.java Implements expansion of dependency/exclusion id and mixin gav during normalization.
impl/​maven-core/​src/​test/​resources/​projects/​transform/​jar-with-id/​before.pom Adds transform fixture using compact id attributes.
impl/​maven-core/​src/​test/​resources/​projects/​transform/​jar-with-id/​after.pom Adds expected transformed consumer POM with expanded fields.
impl/​maven-core/​src/​test/​java/​org/​apache/​maven/​internal/​transformation/​impl/​ConsumerPomArtifactTransformerTest.java Adds consumer POM transformation test covering id expansion.
impl/​maven-core/​src/​main/​java/​org/​apache/​maven/​internal/​transformation/​impl/​DefaultConsumerPomBuilder.java Expands dependency/exclusion id attributes before consumer POM generation.
impl/​maven-cli/​src/​test/​java/​org/​apache/​maven/​cling/​invoker/​mvnup/​goals/​DependencyIdStrategyTest.java Adds mvnup tests for collapsing verbose dependencies/exclusions into id.
impl/​maven-cli/​src/​main/​java/​org/​apache/​maven/​cling/​invoker/​mvnup/​goals/​DependencyIdStrategy.java Adds mvnup strategy that writes compact id attributes.
api/​maven-api-model/​src/​main/​mdo/​maven.mdo Adds model fields for dependency/exclusion id and mixin id (mapped to gav).

Review effort: Lite

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/DependencyIdStrategy.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/DependencyIdStrategy.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/DependencyIdStrategy.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...e/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...e/src/main/java/org/apache/maven/internal/transformation/impl/DefaultConsumerPomBuilder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet-bot
gnodet-bot suggested changes Oct 20, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 837451cb — tightening id validation for mixin/exclusion empty segments and fixing type/classifier conflict checks.

The mixin empty-segment check and exclusion empty-segment check are both correct and clean. However, validateDependencyIdAttribute has an off-by-one in the length thresholds for the type and classifier conflict checks that introduces a regression.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet-bot
gnodet-bot approved these changes Oct 20, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 9c60e0ed — both off-by-one bugs from the previous CHANGES_REQUESTED are fixed.

Previous findings resolved:

  1. ✅ Type-conflict threshold — was parts.length >= 3, now correctly >= 4. In the 3-part format g:a:version, position 2 is the version, not the type; type only appears in the 4-part format g:a:type:[version].
  2. ✅ Classifier-conflict threshold — was parts.length >= 4, now correctly >= 5. Classifier at position 3 only appears in the 5-part format g:a:type:classifier:[version]; in the 4-part format, position 3 is the version.

The new commit also adds deduplication key derivation (managementKeyFromId) for id-attributed dependencies before normalization runs — the logic correctly strips the @scope and ? suffixes and handles all 2-to-5-part formats. Two new test fixtures (dependency-id-duplicate-same-version.xml and dependency-id-duplicate-versions.xml) cover the duplicate-detection path.

All previous findings are resolved. LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet approved these changes Oct 20, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 9c60e0ed1f — fixes the off-by-one thresholds and dedup key semantics flagged in the previous review.

Previous CHANGES_REQUESTED findings resolved:

  1. Off-by-one in type conflict threshold — parts.length >= 3 corrected to parts.length >= 4. A 3-part id (g:a:v) has the version at parts[2], not a type; the type conflict check should only fire for 4+ part ids. ✅
  2. Off-by-one in classifier conflict threshold — parts.length >= 4 corrected to parts.length >= 5. A 4-part id (g:a:type:v) has the version at parts[3], not a classifier; the classifier conflict check should only fire for 5-part ids. ✅

Copilot dedup key finding also resolved in the same commit:

  • stripScopeAndOptional(id) replaced by managementKeyFromId(id) which properly derives the management key (g:a:type[:classifier]) from the id — excluding the version — so two declarations with the same coordinates but different versions are correctly detected as duplicates. ✅
  • Two new test cases added: same dependency declared twice (same version) and same g:a with two different versions. ✅

All PR-specific unit tests pass locally:

  • DefaultModelNormalizerTest: ✅
  • DefaultModelValidatorTest: ✅
  • MavenStaxReaderTest: ✅
  • DependencyIdStrategyTest: ✅
  • ConsumerPomArtifactTransformerTest: ✅

Remaining (low, not blocking):

  • ~150 lines of duplicated expansion logic across normalizer and consumer POM builder — maintenance risk acknowledged, not blocking.
  • Missing mixin id/gav validation tests in DefaultModelValidatorTest — coverage gap, not blocking.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet-bot
gnodet-bot approved these changes Oct 20, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after commit 9c60e0ed1f — management-key fix and off-by-one correction.

Previous findings resolved:

  1. Off-by-one in type conflict check: parts.length >= 3 → >= 4 — fixed ✅
  2. Off-by-one in classifier conflict check: parts.length >= 4 → >= 5 — fixed ✅
  3. Dedup key retained version instead of using management-key semantics — fixed with new managementKeyFromId() helper ✅

All unit tests pass locally (DefaultModelNormalizerTest, DefaultModelValidatorTest). Logic is now correct:

  • 3-part id g:a:v: type-conflict check skipped (parts.length=3, threshold=4) ✓
  • 4-part id g:a:type:v: type-conflict triggered, classifier check skipped (parts.length=4, threshold=5) ✓
  • 5-part id g:a:type:cls:v: both checks triggered ✓

The management key derivation in managementKeyFromId() correctly mirrors getManagementKey() semantics.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
linghengqian
linghengqian reviewed Oct 20, 2026
View reviewed changes

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I have to admit I’m a bit curious: why does a bot need to approve a PR three times? Is this some kind of joke referencing the "three-way handshake" and "four-way handshake" [TCP connection/termination] processes?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rmannibucau reacted with laugh emoji
All reactions
  • 😄 1 reaction
@gnodet

gnodet commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@linghengqian Not TCP handshakes, just iterative review cycles 😄

Each approval corresponds to a distinct push by the contributor that addressed findings from the previous review pass:

  • 1st approval (Sep 10): after the type-check inconsistency between normalizer and consumer POM builder was fixed
  • 2nd approval (Sep 24): docs-only push (EXPECT comments on XML fixtures) — no behavior change, previous approval rationale still valid
  • 3rd approval (Oct 20): after the off-by-one thresholds in the type/classifier conflict checks and the dedup key semantics were fixed

GitHub dismisses a previous approval when new commits are pushed, so each round of fixes requires a fresh approval to keep the reviewDecision: APPROVED state. The bot re-reviews each push and approves again if the findings are resolved. Three pushes addressing findings → three approvals.

linghengqian reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot stopped reviewing on behalf of cstamas due to an error October 20, 2026 21:38
The job was not acquired by a runner even after multiple attempts.
ascheman
ascheman approved these changes Nov 5, 2026
View reviewed changes

@ascheman ascheman left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed the id/gav expansion end to end. DefaultModelNormalizer (segment parsing, empty-segment inference, explicit-child-wins, @scope/? handling, type=="jar" treated as unset) and the matching DefaultModelValidator format/conflict checks line up consistently, and the object-pool equals/hashCode plus the raw-dedup key correctly account for the new field. The validation fixtures cover the valid / managed-version / conflict / duplicate matrix thoroughly.

LGTM for the 4.2 feature. (Reviewed by reading the model, normalizer, validator and object-pool changes; I did not run a local core build — CI is green.) Thanks @rbygrave and @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet approved these changes Nov 5, 2026
View reviewed changes
gnodet added a commit to gnodet/maven that referenced this pull request Nov 6, 2026
@gnodet
feat: use XML attributes for ReactorExtension fields; add id=g:a:v sh…
6221e58
…orthand

Switch ReactorExtension fields (groupId, artifactId, version,
classLoadingStrategy) to xml.attribute="true" so the compact attribute
form is the natural syntax in reactor.xml:

  <extension groupId="io.takari.maven" artifactId="takari-smart-builder" version="0.6.1"/>

Also add an id attribute accepting a compact groupId:artifactId:version
coordinate, consistent with the id shorthand proposed for Dependency and
other model elements in apache#11904:

  <extension id="io.takari.maven:takari-smart-builder:0.6.1"/>

The id field is mutually exclusive with the individual coordinate
attributes. BaseParser resolves id -> groupId/artifactId/version before
building the CoreExtension, with a clear error for malformed coordinates.

The getId() codeSegment is removed because id is now a first-class model
field generated by Modello.
@gnodet gnodet mentioned this pull request Nov 6, 2026
reactor.xml: named build aliases and lifecycle phase injections #13249
Closed
2 of 3 tasks
gnodet added a commit to gnodet/maven that referenced this pull request Nov 6, 2026
@gnodet
feat: use XML attributes for ReactorExtension fields; add id=g:a:v sh…
f67ea56
…orthand

Switch ReactorExtension fields (groupId, artifactId, version,
classLoadingStrategy) to xml.attribute="true" so the compact attribute
form is the natural syntax in reactor.xml:

  <extension groupId="io.takari.maven" artifactId="takari-smart-builder" version="0.6.1"/>

Also add an id attribute accepting a compact groupId:artifactId:version
coordinate, consistent with the id shorthand proposed for Dependency and
other model elements in apache#11904:

  <extension id="io.takari.maven:takari-smart-builder:0.6.1"/>

The id field is mutually exclusive with the individual coordinate
attributes. BaseParser resolves id -> groupId/artifactId/version before
building the CoreExtension, with a clear error for malformed coordinates.

The getId() codeSegment is removed because id is now a first-class model
field generated by Modello.
gnodet added a commit to gnodet/maven that referenced this pull request Nov 6, 2026
@gnodet
feat: use XML attributes for ReactorExtension fields; add id=g:a:v sh…
404f32c
…orthand

Switch ReactorExtension fields (groupId, artifactId, version,
classLoadingStrategy) to xml.attribute="true" so the compact attribute
form is the natural syntax in reactor.xml:

  <extension groupId="io.takari.maven" artifactId="takari-smart-builder" version="0.6.1"/>

Also add an id attribute accepting a compact groupId:artifactId:version
coordinate, consistent with the id shorthand proposed for Dependency and
other model elements in apache#11904:

  <extension id="io.takari.maven:takari-smart-builder:0.6.1"/>

The id field is mutually exclusive with the individual coordinate
attributes. BaseParser resolves id -> groupId/artifactId/version before
building the CoreExtension, with a clear error for malformed coordinates.

The getId() codeSegment is removed because id is now a first-class model
field generated by Modello.
gnodet added a commit to gnodet/maven that referenced this pull request Nov 8, 2026
@gnodet
feat: use XML attributes for ReactorExtension fields; add id=g:a:v sh…
5483e34
…orthand

Switch ReactorExtension fields (groupId, artifactId, version,
classLoadingStrategy) to xml.attribute="true" so the compact attribute
form is the natural syntax in reactor.xml:

  <extension groupId="io.takari.maven" artifactId="takari-smart-builder" version="0.6.1"/>

Also add an id attribute accepting a compact groupId:artifactId:version
coordinate, consistent with the id shorthand proposed for Dependency and
other model elements in apache#11904:

  <extension id="io.takari.maven:takari-smart-builder:0.6.1"/>

The id field is mutually exclusive with the individual coordinate
attributes. BaseParser resolves id -> groupId/artifactId/version before
building the CoreExtension, with a clear error for malformed coordinates.

The getId() codeSegment is removed because id is now a first-class model
field generated by Modello.
@gnodet gnodet mentioned this pull request Nov 9, 2026
Dependency management import should support explicit inclusion #13897
Open
2 tasks done
@gnodet @rbygrave
feat: Add compact id attribute (GAV shorthand) for Dependency, Exclus…
60d0af9
…ion, Mixin (apache#11904)

Add a compact `id` attribute to `<dependency>`, `<exclusion>`, and `<mixin>`
elements in the Maven model (4.2.0+). Instead of verbose coordinate child
elements, users can write:

```xml
<dependency id="org.slf4j:slf4j-api:2.0.17"/>
<dependency id="org.postgresql:postgresql:42.7.3@runtime">
  <exclusions>
    <exclusion id="*:*"/>
  </exclusions>
</dependency>
<mixin id="com.example.mixins:java-mixin:1.0.0"/>
```

Supported formats:
- Dependency: `g:a:v`, `g:a:v@scope`, `g:a:v?` (optional), `g:a:v@scope?`
- Full form: `g:a:type:classifier:v` (with optional @scope and ?)
- Managed-version: `g:a` (2-part), `g:a:`, `g:a:type:`, `g:a:type:classifier:`
- Exclusion: `g:a`
- Mixin: `g:a:v`

The normalizer expands `id` into individual coordinate fields before model
building, so consumer POMs never contain the attribute. The validator checks
for conflicts between `id` and explicit child fields.

Also adds a `mvnup` `DependencyIdStrategy` that collapses verbose dependency/
exclusion coordinates into compact `id` attributes when upgrading to model
version 4.2.0.

Co-authored-by: Rob Bygrave <[email protected]>
@gnodet
gnodet force-pushed the feature/dependency-id-attribute branch from 9c60e0e to 60d0af9 Compare November 26, 2026 14:51
@gnodet
fix: add missing closing brace in MavenStaxReaderTest#pomWithNamespace
25a2032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@gnodet gnodet gnodet approved these changes
@ascheman ascheman ascheman approved these changes
@cstamas cstamas Awaiting requested review from cstamas
@hboutemy hboutemy Awaiting requested review from hboutemy
@rmannibucau rmannibucau Awaiting requested review from rmannibucau
@slawekjaranowski slawekjaranowski Awaiting requested review from slawekjaranowski
@Bukama Bukama Awaiting requested review from Bukama
@slachiewicz slachiewicz Awaiting requested review from slachiewicz
+2 more reviewers
@linghengqian linghengqian linghengqian left review comments
@gnodet-bot gnodet-bot gnodet-bot approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request mvn4

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@rbygrave @gnodet @rmannibucau @ascheman @linghengqian @gnodet-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.