Skip to content

[MNG-8432] Integration test for MNG-8432 using mixins#12461

Merged
gnodet merged 2 commits into
apache:masterfrom
Hiteshsai007:mixin-properties-integration-test
Jul 17, 2026
Merged

[MNG-8432] Integration test for MNG-8432 using mixins#12461
gnodet merged 2 commits into
apache:masterfrom
Hiteshsai007:mixin-properties-integration-test

Conversation

@Hiteshsai007

@Hiteshsai007 Hiteshsai007 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR adds an integration test to demonstrate and document the correct usage of the <mixins> feature (introduced in Maven 4.2.0) as the native and architecturally preferred solution to MNG-8432.

As discussed in the original PR #12417 (which proposed extending <dependency> BOM imports to include properties), inheriting both dependency management and properties from a shared BOM-like module is a highly requested use case (e.g. for Spring Boot, Quarkus). However, extending dependencyManagement imports to pull properties introduces significant risks around property pollution, silent semantic drift, and ordering fragility.

Instead, as @gnodet correctly pointed out, Mixins are the supported mechanism for this use case. Following his suggestion, this integration test (MavenITmng8432MixinsPropertiesTest) explicitly verifies that when a project uses a <mixin>, it successfully inherits both:

  1. dependencyManagement (verified by the consumer being able to resolve the managed dependency)
  2. properties (verified by checking the effective-pom for the inherited property)

This serves as both a regression test for the mixin functionality and as executable documentation for users encountering the MNG-8432 use case.

@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.

Review — Integration Test for MNG-8432

This PR adds an integration test that verifies mixin-based property and dependency management inheritance, targeting the MNG-8432 scenario. The test follows the established patterns in MavenITmng5102MixinsTest and MavenITmng11133MixinsPrecedenceTest.

Observations

🔵 Low — Partial overlap with existing mixin tests
MavenITmng5102MixinsTest already covers mixin property inheritance. However, this test specifically targets the MNG-8432 scenario (BOM-style mixin with both properties and <dependencyManagement> via GAV resolution), which is a valid regression test for the reported issue.

🔵 Low — String matching on effective POM
The test uses Files.readString() + String.contains() on the effective POM XML. The Maven IT convention typically uses maven-it-plugin-expression with verifier.loadProperties(), which is more robust against whitespace/formatting changes. That said, MavenITmng11133MixinsPrecedenceTest uses the same Files.readString + contains approach, so this is an established alternative pattern.

Summary

Clean integration test that follows existing conventions. The test correctly installs the mixin BOM, then verifies that the consumer project's effective POM includes both the inherited property and the managed dependency. No blocking issues found. ✅


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

gnodet added a commit to gnodet/maven that referenced this pull request Jul 10, 2026
New MNG-8432 integration test PR. Verifier caught 8/10 false positives
from reviewer (outdated API assumptions). 2 LOW observations posted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@elharo elharo changed the title Integration test for MNG-8432 using mixins [MNG-8432] Integration test for MNG-8432 using mixins Jul 10, 2026
@Hiteshsai007
Hiteshsai007 requested review from elharo and gnodet July 10, 2026 13:14
Replace help:effective-pom + Files.readString/String.contains with the
conventional maven-it-plugin-expression approach using
verifier.loadProperties(), which is more robust against
whitespace/formatting changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet

gnodet commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Proposed solution for MNG-8432

The use case described in MNG-8432 — inheriting both <dependencyManagement> and <properties> from a BOM-like project — is already supported by the Mixins feature (model version 4.2.0).

Instead of extending BOM <scope>import</scope> semantics to include properties (which risks property pollution, silent semantic drift, and ordering fragility), a project can declare a <mixin> to inherit both dependency management and properties from a shared module:

<project xmlns="http://maven.apache.org/POM/4.2.0" root="true" ...>
  <modelVersion>4.2.0</modelVersion>
  ...
  <mixins>
    <mixin>
      <groupId>com.example</groupId>
      <artifactId>my-bom</artifactId>
      <version>1.0</version>
    </mixin>
  </mixins>
</project>

This PR adds an integration test verifying this behavior — that the consumer project successfully inherits both properties and managed dependencies from the mixin BOM.

@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.

AI Re-Review — PR #12461 (new commit)

Verdict: ✅ APPROVE

Summary: The new commit (bf5ac5c — "Use maven-it-plugin-expression instead of effective POM string matching") directly addresses the string-matching observation from the previous review. It replaces the help:effective-pom + Files.readString() + String.contains() approach with the idiomatic maven-it-plugin-expression + verifier.loadProperties() + assertEquals() pattern used by 193+ other integration tests in the suite.

What Changed

  • Before: Ran help:effective-pom, read the output file, and used String.contains() to verify mixin properties and dependencies.
  • After: Uses maven-it-plugin-expression plugin at validate phase to evaluate project/properties and project/dependencyManagement into target/model.properties, then asserts with assertEquals().

Assessment

  • ✅ Follows the established core-it-suite convention (confirmed across 193 test files)
  • ✅ Pattern matches existing tests like MavenITmng5102MixinsTest and MavenITmng5600DependencyManagementImportExclusionsTest
  • ✅ JUnit assertEquals consistent with all existing Maven ITs
  • ✅ Responsive to prior review feedback — commit title explicitly signals what changed
  • ⏳ CI checks still pending (just pushed today) — expected to pass given the well-structured test

No findings. Clean, targeted improvement.


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

gnodet added a commit to gnodet/maven that referenced this pull request Jul 17, 2026
Re-review of apache#12461 — new commit addressed prior string matching
feedback. APPROVED.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet added the enhancement New feature or request label Jul 17, 2026
@gnodet gnodet added this to the 4.1.0 milestone Jul 17, 2026
@gnodet gnodet self-assigned this Jul 17, 2026
@gnodet
gnodet merged commit 671031e into apache:master Jul 17, 2026
19 of 20 checks passed
@Hiteshsai007
Hiteshsai007 deleted the mixin-properties-integration-test branch July 17, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants