gnodet-bot commented on code in PR #14168:
URL: https://github.com/apache/maven/pull/14168#discussion_r4730430767
##########
impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ToolchainPluginStrategyTest.java:
##########
@@ -603,6 +603,182 @@ void noDuplicatePlugin() {
}
}
+ @Nested
+ @DisplayName("Reactor-wide minimum source level (#14166)")
+ class ReactorMinSourceLevelTests {
+
+ private static final Path ROOT_POM = Paths.get("/project/pom.xml");
+ private static final Path CHILD_POM =
Paths.get("/project/child/pom.xml");
+
+ private ToolchainPluginStrategy strategy;
+
+ @BeforeEach
+ void setUp() {
+ strategy = new ToolchainPluginStrategy();
+ }
+
+ @Test
+ @DisplayName("should add toolchain to root POM when child module
declares a retired source level")
+ void addsToolchainToRootWhenChildHasRetiredLevel() {
+ // Root POM: source=8 (not retired) — without reactor-wide check
the root would be skipped
+ String rootPomXml = """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.example</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>child</module>
+ </modules>
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+ </project>
+ """;
+ // Child POM: source=5 (retired, requires JDK <= 8)
+ String childPomXml = """
+ <?xml version="1.0" encoding="UTF-8"?>
+ <project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.example</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>child</artifactId>
+ <properties>
+ <maven.compiler.source>1.5</maven.compiler.source>
+ <maven.compiler.target>1.5</maven.compiler.target>
+ </properties>
+ </project>
+ """;
+ Document rootDoc = Document.of(rootPomXml);
+ Document childDoc = Document.of(childPomXml);
+ UpgradeContext context = TestUtils.createMockContext();
+
+ Map<Path, Document> pomMap = new java.util.LinkedHashMap<>();
Review Comment:
🔹 **Nit: FQCN instead of import** — `java.util.LinkedHashMap` is used as a
fully-qualified name in three test methods instead of an import. Minor style
inconsistency; the production code properly imports its types. Same pattern at
lines ~718 and ~763.
```suggestion
Map<Path, Document> pomMap = new LinkedHashMap<>();
```
(with `import java.util.LinkedHashMap;` in the imports section)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]