Add maven4-build-vs-consumer-pom: Maven 4.0.0-rc-7 build POM vs consumer POM, lifecycle hooks, mvnup, mvnd

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4XrpfdpsacrvqnrBM
This commit is contained in:
Ankur Mhatre
2026-11-26 21:03:12 +05:30
co-authored by Claude Sonnet 5.5
commit f32c088174
38 changed files with 1491 additions and 0 deletions
@@ -0,0 +1 @@
-Drevision=1.0.0-SNAPSHOT
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
<parent/>
<artifactId>m4-app</artifactId>
<packaging>jar</packaging>
<dependencies>
<!-- 4.1.0: no <version> needed for a sibling subproject -->
<dependency>
<groupId>com.ankurm.m4</groupId>
<artifactId>m4-lib</artifactId>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,9 @@
package com.ankurm.m4.app;
import com.ankurm.m4.Greeter;
public class Main {
public static void main(String[] args) {
System.out.println(Greeter.greet("reader"));
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
<!-- 4.1.0: parent coordinates inferred from ../pom.xml -->
<parent/>
<artifactId>m4-bom</artifactId>
<!-- 4.1.0: dedicated packaging for dependency-management-only POMs -->
<packaging>bom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.ankurm.m4</groupId>
<artifactId>m4-lib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
<parent/>
<artifactId>m4-lib</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.13.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- 4.1.0: <sources> replaces <sourceDirectory>/<testSourceDirectory> -->
<sources>
<source>
<scope>main</scope>
<directory>src/main/java</directory>
</source>
<source>
<scope>test</scope>
<directory>src/test/java</directory>
</source>
</sources>
</build>
</project>
@@ -0,0 +1,10 @@
package com.ankurm.m4;
/** Tiny library class so the demo has something real to compile, test and package. */
public final class Greeter {
private Greeter() {}
public static String greet(String name) {
return "Hello, " + name + " (built with Maven 4)";
}
}
@@ -0,0 +1,12 @@
package com.ankurm.m4;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class GreeterTest {
@Test
void greets() {
assertEquals("Hello, Ankur (built with Maven 4)", Greeter.greet("Ankur"));
}
}
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- BUILD POM. Model 4.1.0: only Maven 4 can read this file. -->
<project xmlns="http://maven.apache.org/POM/4.1.0" root="true">
<modelVersion>4.1.0</modelVersion>
<groupId>com.ankurm.m4</groupId>
<artifactId>m4-demo</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- 4.1.0: <subprojects> replaces <modules> -->
<subprojects>
<subproject>bom</subproject>
<subproject>lib</subproject>
<subproject>app</subproject>
</subprojects>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.4</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>