This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 671031e6c1 [MNG-8432] Integration test for mixin-based property and
dependency management inheritance
671031e6c1 is described below
commit 671031e6c1d6bd2302f8898513c4c14adac4171b
Author: B V HITESH SAI <[email protected]>
AuthorDate: Fri Jul 17 16:42:35 2026 +0530
[MNG-8432] Integration test for mixin-based property and dependency
management inheritance
* Integration test for MNG-8432 using mixins
* Use maven-it-plugin-expression instead of effective POM string matching
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 <[email protected]>
---------
Co-authored-by: Guillaume Nodet <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
---
.../it/MavenITmng8432MixinsPropertiesTest.java | 77 ++++++++++++++++++++++
.../mng-8432-mixins-properties/managed-dep/pom.xml | 10 +++
.../mng-8432-mixins-properties/mixin-bom/pom.xml | 24 +++++++
.../mng-8432-mixins-properties/project/pom.xml | 50 ++++++++++++++
4 files changed, 161 insertions(+)
diff --git
a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8432MixinsPropertiesTest.java
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8432MixinsPropertiesTest.java
new file mode 100644
index 0000000000..27eaffd440
--- /dev/null
+++
b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8432MixinsPropertiesTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Path;
+import java.util.Properties;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * This is a test set for <a
href="https://issues.apache.org/jira/browse/MNG-8432">MNG-8432</a>.
+ * <p>
+ * Demonstrates that the {@code <mixins>} feature (Maven 4.2.0+) is the proper
solution
+ * for inheriting both dependency management and properties from a BOM-like
project,
+ * instead of extending BOM import semantics.
+ * </p>
+ */
+public class MavenITmng8432MixinsPropertiesTest extends
AbstractMavenIntegrationTestCase {
+
+ /**
+ * Verify that a project using a mixin inherits both properties and
+ * dependency management from the mixin POM.
+ *
+ * @throws Exception in case of failure
+ */
+ @Test
+ public void testMixinProvidesDependencyManagementAndProperties() throws
Exception {
+ Path testDir = extractResources("/mng-8432-mixins-properties");
+
+ // 1. Install the mixin-bom which provides properties and
dependencyManagement
+ Verifier verifier = newVerifier(testDir.resolve("mixin-bom"));
+ verifier.setAutoclean(false);
+ verifier.deleteDirectory("target");
+ verifier.deleteArtifacts("org.apache.maven.its.mng8432");
+ verifier.addCliArgument("install");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ // 2. Build the consuming project and evaluate model expressions
+ verifier = newVerifier(testDir.resolve("project"));
+ verifier.setAutoclean(false);
+ verifier.deleteDirectory("target");
+ verifier.addCliArgument("validate");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ // 3. Verify the model contains the mixin's property and managed
dependency
+ verifier.verifyFilePresent("target/model.properties");
+ Properties props = verifier.loadProperties("target/model.properties");
+ assertEquals(
+ "mixin-value",
+ props.getProperty("project.properties.mixin.property"),
+ "Property from mixin BOM should be inherited by the consuming
project");
+ assertEquals(
+ "org.apache.maven.its.mng8432:managed-dep:jar",
+
props.getProperty("project.dependencyManagement.dependencies.0.managementKey"),
+ "Dependency management from mixin BOM should be inherited by
the consuming project");
+ }
+}
diff --git
a/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/managed-dep/pom.xml
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/managed-dep/pom.xml
new file mode 100644
index 0000000000..73a30f03b7
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/managed-dep/pom.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>managed-dep</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-8432 :: Managed Dep</name>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/mixin-bom/pom.xml
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/mixin-bom/pom.xml
new file mode 100644
index 0000000000..ad4ed711d6
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/mixin-bom/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.2.0
http://maven.apache.org/xsd/maven-4.2.0.xsd">
+ <modelVersion>4.2.0</modelVersion>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>mixin-bom</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MNG-8432 :: Mixin BOM</name>
+
+ <properties>
+ <mixin.property>mixin-value</mixin.property>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>managed-dep</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
diff --git
a/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/project/pom.xml
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/project/pom.xml
new file mode 100644
index 0000000000..ae4a59c4e1
--- /dev/null
+++
b/its/core-it-suite/src/test/resources/mng-8432-mixins-properties/project/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" root="true"
xsi:schemaLocation="http://maven.apache.org/POM/4.2.0
http://maven.apache.org/xsd/maven-4.2.0.xsd">
+ <modelVersion>4.2.0</modelVersion>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>project</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: MNG-8432 :: Project</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>managed-dep</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-expression</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>eval</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputFile>target/model.properties</outputFile>
+ <expressions>
+ <expression>project/properties</expression>
+ <expression>project/dependencyManagement</expression>
+ </expressions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <mixins>
+ <mixin>
+ <groupId>org.apache.maven.its.mng8432</groupId>
+ <artifactId>mixin-bom</artifactId>
+ <version>1.0</version>
+ </mixin>
+ </mixins>
+</project>