This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch stable-namespace-version-tags in repository https://gitbox.apache.org/repos/asf/maven.git
commit 1ac3f6b642313cc33b08676e0261644cb0877bf7 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Sat Mar 14 13:26:24 2026 +0100 Implement stable namespace with version tags Changed Maven schema versioning from namespace-based to version tags: - All Maven versions (4.0.0+) now use stable namespace: http://maven.apache.org/POM/4.0.0 - Version is specified in <modelVersion> element instead of namespace URI - Schema location remains version-specific (maven-4.1.0.xsd, etc.) - Removed namespace-based version detection and validation - Removed namespace version extraction from ModelBuilder - Updated upgrade tools to only update schema location, not namespace - Disabled namespace-based modelVersion inference optimization - Updated tests and documentation Benefits: - Single stable namespace across all Maven versions - Simpler version management and tooling compatibility - Clearer version declaration in POM files - Version-specific XSD validation maintained This addresses the proposal from https://lists.apache.org/thread/f012nxx8msltcp06f2h848n1rkowl4kj --- api/maven-api-model/src/main/mdo/maven.mdo | 2 +- .../invoker/mvnup/goals/InferenceStrategy.java | 14 +- .../invoker/mvnup/goals/ModelUpgradeStrategy.java | 38 +- .../invoker/mvnup/goals/ModelVersionUtils.java | 19 +- .../invoker/mvnup/goals/ModelVersionUtilsTest.java | 2 +- .../transformation/impl/TransformerSupport.java | 4 +- .../apache/maven/impl/DefaultModelXmlFactory.java | 22 +- .../maven/impl/model/DefaultModelBuilder.java | 8 - maven-3.9-to-4.0-migration-guide.md | 960 +++++++++++++++++++++ maven-4.0.x-since-rc-5-analysis.md | 489 +++++++++++ maven-4.0.x-vs-master-analysis.md | 407 +++++++++ src/mdo/writer-stax.vm | 2 +- 12 files changed, 1879 insertions(+), 88 deletions(-) diff --git a/api/maven-api-model/src/main/mdo/maven.mdo b/api/maven-api-model/src/main/mdo/maven.mdo index 74aff7785e..a98fb86cc1 100644 --- a/api/maven-api-model/src/main/mdo/maven.mdo +++ b/api/maven-api-model/src/main/mdo/maven.mdo @@ -45,7 +45,7 @@ --> <model xmlns="http://codehaus-plexus.github.io/MODELLO/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/2.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-2.0.0.xsd" - xml.namespace="http://maven.apache.org/POM/${version}" + xml.namespace="http://maven.apache.org/POM/4.0.0" xml.schemaLocation="https://maven.apache.org/xsd/maven-${version}.xsd"> <id>maven</id> <name>Maven</name> diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategy.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategy.java index 800136cfdd..2a885ca9d5 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategy.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/InferenceStrategy.java @@ -304,20 +304,10 @@ private boolean applySubprojectsInference(UpgradeContext context, Document pomDo /** * Applies model version inference optimization. - * Removes modelVersion element when it can be inferred from namespace. + * This optimization was based on inferring version from namespace. + * With stable namespace, this optimization is no longer applicable. */ private boolean applyModelVersionInference(UpgradeContext context, Document pomDocument) { - String currentVersion = ModelVersionUtils.detectModelVersion(pomDocument); - - // Only remove modelVersion for 4.1.0+ models where it can be inferred from namespace - if (MODEL_VERSION_4_1_0.equals(currentVersion) || ModelVersionUtils.isNewerThan410(currentVersion)) { - - if (ModelVersionUtils.removeModelVersion(pomDocument)) { - context.detail("Removed: modelVersion element (can be inferred from namespace)"); - return true; - } - } - return false; } diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategy.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategy.java index f0a5559d52..8a741b05e7 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategy.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategy.java @@ -49,8 +49,6 @@ import static eu.maveniverse.domtrip.maven.MavenPomElements.Elements.SUBPROJECTS; import static eu.maveniverse.domtrip.maven.MavenPomElements.ModelVersions.MODEL_VERSION_4_0_0; import static eu.maveniverse.domtrip.maven.MavenPomElements.ModelVersions.MODEL_VERSION_4_1_0; -import static eu.maveniverse.domtrip.maven.MavenPomElements.Namespaces.MAVEN_4_0_0_NAMESPACE; -import static eu.maveniverse.domtrip.maven.MavenPomElements.Namespaces.MAVEN_4_1_0_NAMESPACE; import static org.apache.maven.cling.invoker.mvnup.goals.ModelVersionUtils.getSchemaLocationForModelVersion; /** @@ -158,8 +156,8 @@ private Document performModelUpgrade( context.detail("Added modelVersion " + targetModelVersion); } - // Update namespace and schema location - upgradeNamespaceAndSchemaLocation(editor, context, targetModelVersion); + // Update schema location only (namespace remains at 4.0.0) + upgradeSchemaLocation(editor, context, targetModelVersion); // Convert modules to subprojects (for 4.1.0 and higher) if (ModelVersionUtils.isVersionGreaterOrEqual(targetModelVersion, MODEL_VERSION_4_1_0)) { @@ -172,27 +170,22 @@ private Document performModelUpgrade( } /** - * Updates namespace and schema location for the target model version using domtrip. + * Updates schema location for the target model version using domtrip. + * Namespace remains at http://maven.apache.org/POM/4.0.0 for all versions. */ - private void upgradeNamespaceAndSchemaLocation(Editor editor, UpgradeContext context, String targetModelVersion) { + private void upgradeSchemaLocation(Editor editor, UpgradeContext context, String targetModelVersion) { Element root = editor.root(); if (root == null) { return; } - // Update namespace based on target model version - String targetNamespace = getNamespaceForModelVersion(targetModelVersion); - - // Use element's attribute method to set the namespace declaration - // This modifies the element in place and marks it as modified - root.attribute("xmlns", targetNamespace); - context.detail("Updated namespace to " + targetNamespace); - - // Update schema location if present + // Only update schema location if present String currentSchemaLocation = root.attribute("xsi:schemaLocation"); if (currentSchemaLocation != null) { + String namespace = "http://maven.apache.org/POM/4.0.0"; String newSchemaLocation = getSchemaLocationForModelVersion(targetModelVersion); - root.attribute("xsi:schemaLocation", newSchemaLocation); + String fullSchemaLocation = namespace + " " + newSchemaLocation; + root.attribute("xsi:schemaLocation", fullSchemaLocation); context.detail("Updated xsi:schemaLocation"); } } @@ -264,19 +257,6 @@ private String determineTargetModelVersion(UpgradeContext context) { } } - /** - * Gets the namespace URI for a model version. - */ - private String getNamespaceForModelVersion(String modelVersion) { - if (MavenPomElements.ModelVersions.MODEL_VERSION_4_2_0.equals(modelVersion)) { - return MavenPomElements.Namespaces.MAVEN_4_2_0_NAMESPACE; - } else if (MODEL_VERSION_4_1_0.equals(modelVersion)) { - return MAVEN_4_1_0_NAMESPACE; - } else { - return MAVEN_4_0_0_NAMESPACE; - } - } - /** * Upgrades deprecated Maven 3 phase names to Maven 4 equivalents. * This replaces pre-/post- phases with before:/after: phases. diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtils.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtils.java index 783cb1d621..c0fc1aad42 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtils.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtils.java @@ -26,9 +26,6 @@ import static eu.maveniverse.domtrip.maven.MavenPomElements.ModelVersions.MODEL_VERSION_4_0_0; import static eu.maveniverse.domtrip.maven.MavenPomElements.ModelVersions.MODEL_VERSION_4_1_0; import static eu.maveniverse.domtrip.maven.MavenPomElements.ModelVersions.MODEL_VERSION_4_2_0; -import static eu.maveniverse.domtrip.maven.MavenPomElements.Namespaces.MAVEN_4_0_0_NAMESPACE; -import static eu.maveniverse.domtrip.maven.MavenPomElements.Namespaces.MAVEN_4_1_0_NAMESPACE; -import static eu.maveniverse.domtrip.maven.MavenPomElements.Namespaces.MAVEN_4_2_0_NAMESPACE; import static eu.maveniverse.domtrip.maven.MavenPomElements.SchemaLocations.MAVEN_4_0_0_SCHEMA_LOCATION; import static eu.maveniverse.domtrip.maven.MavenPomElements.SchemaLocations.MAVEN_4_1_0_SCHEMA_LOCATION; import static eu.maveniverse.domtrip.maven.MavenPomElements.SchemaLocations.MAVEN_4_2_0_SCHEMA_LOCATION; @@ -47,7 +44,7 @@ private ModelVersionUtils() { /** * Detects the model version from a POM document. - * Uses both the modelVersion element and namespace URI for detection. + * Reads the modelVersion element only. * * @param pomDocument the POM document (domtrip Document) * @return the detected model version @@ -59,7 +56,7 @@ public static String detectModelVersion(Document pomDocument) { return MODEL_VERSION_4_0_0; } - // First try to get from modelVersion element + // Only read from modelVersion element Element modelVersionElement = root.child(MODEL_VERSION).orElse(null); if (modelVersionElement != null) { String modelVersion = modelVersionElement.textContentTrimmed(); @@ -68,17 +65,7 @@ public static String detectModelVersion(Document pomDocument) { } } - // Fallback to namespace URI detection - String namespaceUri = root.namespaceDeclaration(null); - if (MAVEN_4_2_0_NAMESPACE.equals(namespaceUri)) { - return MODEL_VERSION_4_2_0; - } else if (MAVEN_4_1_0_NAMESPACE.equals(namespaceUri)) { - return MODEL_VERSION_4_1_0; - } else if (MAVEN_4_0_0_NAMESPACE.equals(namespaceUri)) { - return MODEL_VERSION_4_0_0; - } - - // Default fallback + // No fallback to namespace - require modelVersion element return MODEL_VERSION_4_0_0; } diff --git a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java index cd5e1f0d14..7f6bec6a18 100644 --- a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java +++ b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/ModelVersionUtilsTest.java @@ -68,7 +68,7 @@ void shouldDetectModelVersionFromDocument() { @DisplayName("should detect model version") void shouldDetectModelVersionFromNamespace(String targetVersion) throws Exception { String pomXml = PomBuilder.create() - .namespace("http://maven.apache.org/POM/" + targetVersion) + .namespace("http://maven.apache.org/POM/4.0.0") .modelVersion(targetVersion) .groupId("test") .artifactId("test") diff --git a/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/TransformerSupport.java b/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/TransformerSupport.java index 3c4149120d..84d460977f 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/TransformerSupport.java +++ b/impl/maven-core/src/main/java/org/apache/maven/internal/transformation/impl/TransformerSupport.java @@ -64,7 +64,7 @@ public void transform(MavenProject project, RepositorySystemSession session, Mod throw new IllegalStateException("This transformer does not use this call."); } - protected static final String NAMESPACE_FORMAT = "http://maven.apache.org/POM/%s"; + protected static final String NAMESPACE = "http://maven.apache.org/POM/4.0.0"; protected static final String SCHEMA_LOCATION_FORMAT = "https://maven.apache.org/xsd/maven-%s.xsd"; @@ -79,7 +79,7 @@ protected void write(Model model, Path dest) throws IOException, XMLStreamExcept Files.createDirectories(dest.getParent()); try (Writer w = Files.newBufferedWriter(dest)) { MavenStaxWriter writer = new MavenStaxWriter(); - writer.setNamespace(String.format(NAMESPACE_FORMAT, version)); + writer.setNamespace(NAMESPACE); writer.setSchemaLocation(String.format(SCHEMA_LOCATION_FORMAT, version)); writer.setAddLocationInformation(false); writer.write(w, model); diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java index e9ac14d848..7721fe7e20 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java @@ -62,31 +62,17 @@ public class DefaultModelXmlFactory implements ModelXmlFactory { public Model read(@Nonnull XmlReaderRequest request) throws XmlReaderException { requireNonNull(request, "request"); Model model = doRead(request); - if (isModelVersionGreaterThan400(model) - && !model.getNamespaceUri().startsWith("http://maven.apache.org/POM/")) { + boolean isInvalidNamespace = !"http://maven.apache.org/POM/4.0.0".equals(model.getNamespaceUri()); + if (isInvalidNamespace) { throw new XmlReaderException( - "Invalid namespace '" + model.getNamespaceUri() + "' for model version " + model.getModelVersion(), + "Invalid namespace '" + model.getNamespaceUri() + + "'. Only 'http://maven.apache.org/POM/4.0.0' is supported.", null, null); } return model; } - private boolean isModelVersionGreaterThan400(Model model) { - String version = model.getModelVersion(); - if (version == null) { - return false; - } - try { - String[] parts = version.split("\\."); - int major = Integer.parseInt(parts[0]); - int minor = parts.length > 1 ? Integer.parseInt(parts[1]) : 0; - return major > 4 || (major == 4 && minor > 0); - } catch (NumberFormatException | IndexOutOfBoundsException e) { - return false; - } - } - @Nonnull private Model doRead(XmlReaderRequest request) throws XmlReaderException { Path path = request.getPath(); diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java index 60a49fcc2e..1672dd961b 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java @@ -133,7 +133,6 @@ @Singleton public class DefaultModelBuilder implements ModelBuilder { - public static final String NAMESPACE_PREFIX = "http://maven.apache.org/POM/"; private static final String RAW = "raw"; private static final String FILE = "file"; private static final String IMPORT = "import"; @@ -1562,13 +1561,6 @@ Model doReadFileModel() throws ModelBuilderException { throw newModelBuilderException(); } - if (model.getModelVersion() == null) { - String namespace = model.getNamespaceUri(); - if (namespace != null && namespace.startsWith(NAMESPACE_PREFIX)) { - model = model.withModelVersion(namespace.substring(NAMESPACE_PREFIX.length())); - } - } - if (isBuildRequest()) { model = model.withPomFile(modelSource.getPath()); diff --git a/maven-3.9-to-4.0-migration-guide.md b/maven-3.9-to-4.0-migration-guide.md new file mode 100644 index 0000000000..a97d29ee21 --- /dev/null +++ b/maven-3.9-to-4.0-migration-guide.md @@ -0,0 +1,960 @@ +# Maven 3.9 → 4.0 Migration Guide + +**Analysis Date**: February 6, 2026 +**Baseline**: `maven-3.9.12` (latest 3.9 release) +**Target**: `origin/maven-4.0.x` (planned 4.0.0 release) + +--- + +## Executive Summary + +Maven 4.0 represents a **major architectural overhaul** of Apache Maven, introducing: + +- **New public API layer** (`org.apache.maven.api`) +- **Java 17 minimum requirement** +- **Complete rewrite of internal implementation** +- **Modernized dependency injection with Sisu** +- **SLF4J-based logging framework** +- **Performance improvements** (hard links, better caching) +- **New POM model features** (modular sources, profile conditions) +- **Maven upgrade tool** (`mvnup`) + +| Metric | Value | +|--------|-------| +| Total commits | 5,293 | +| Files changed | ~10,787 | +| Lines added | +483,686 | +| Lines deleted | -100,895 | +| Net change | +382,791 lines | +| Development time | ~3+ years | + +--- + +## 1. Platform Requirements + +### 1.1 Java Version + +| Version | Java Version | Notes | +|---------|--------------|-------| +| Maven 3.9 | Java 8+ | Minimum Java 8 | +| **Maven 4.0** | **Java 17+** | **Minimum Java 17** | + +**Impact**: Projects and plugins built with Java < 17 will require: +- Update JDK to 17+ for building +- Possible plugin compatibility updates + +### 1.2 Build Requirements + +Maven 4.0 itself now requires: +- **Java 17** to build +- **Maven 3.6.3+** to bootstrap + +```xml +<!-- Maven 4.0 pom.xml --> +<javaVersion>17</javaVersion> +<maven.compiler.source>${javaVersion}</maven.compiler.source> +<maven.compiler.target>${javaVersion}</maven.compiler.target> +<maven.compiler.release>${javaVersion}</maven.compiler.release> +``` + +--- + +## 2. Major Architectural Changes + +### 2.1 New Public API Layer + +**New Package Structure** in Maven 4.0: +``` +api/ +├── maven-api-annotations # Custom annotations (@Experimental, @Nonnull, etc.) +├── maven-api-cli # Command-line interface API +├── maven-api-core # Core API (Artifact, Dependency, Source, etc.) +├── maven-api-di # Dependency Injection API +├── maven-api-model # Model API +├── maven-api-metadata # Metadata API +├── maven-api-plugin # Plugin API +├── maven-api-settings # Settings API +├── maven-api-spi # Service Provider Interface +├── maven-api-toolchain # Toolchain API +└── maven-api-xml # XML handling API +``` + +**Key API Classes**: +```java +// Core domain objects +org.apache.maven.api.Artifact +org.apache.maven.api.Dependency +org.apache.maven.api.ArtifactCoordinates +org.apache.maven.api.Service +org.apache.maven.api.Source +org.apache.maven.api.SourceRoot +org.apache.maven.api.Project + +// Services (SPI) +org.apache.maven.api.services.ArtifactResolver +org.apache.maven.api.services.DependencyResolver +org.apache.maven.api.services.ModelBuilder +org.apache.maven.api.services.ProjectBuilder +org.apache.maven.api.services.ToolchainManager + +// DI +org.apache.maven.api.di.Inject +org.apache.maven.api.di.Named +org.apache.maven.api.di.Singleton +org.apache.maven.api.di.Provider +``` + +**Impact**: +- Extensions/plugins encouraged to use new `api` layer +- Legacy `org.apache.maven` classes remain in `compat` layer +- New features only available in `api` layer + +### 2.2 Compatibility Layer + +**Purpose**: Provides backward compatibility for existing plugins and extensions. + +**Structure**: +``` +compat/ +├── maven-artifact # Legacy artifact handling +├── maven-builder-support # Builder utilities +├── maven-compat # Shim for Maven 3.x classes +├── maven-embedder # Embed API +├── maven-model # Model v3 compatibility +├── maven-model-builder # Model builder compat +├── maven-plugin-api # Plugin API compat +├── maven-repository-metadata +├── maven-resolver-provider +├── maven-settings +├── maven-settings-builder +├── maven-toolchain-builder +└── maven-toolchain-model +``` + +**Note**: `compat` layer will be removed in future major versions. + +### 2.3 Implementation Layer + +**New Implementation** (`impl/`): +- Modern, clean implementation +- Uses new `api` layer internally +- Sisu-based dependency injection +- SLF4J logging + +``` +impl/ +├── maven-cli # New CLI (CLIng) +├── maven-core # Core operations +├── maven-di # DI setup +├── maven-executor # Plugin execution +├── maven-impl # Service implementations +├── maven-jline # JLine integration +└── maven-logging # Logging setup +``` + +--- + +## 3. New Features + +### 3.1 Maven Upgrade Tool (`mvnup`) + +**Purpose**: Automated upgrade of Maven projects from version 3.x to 4.x. + +**Location**: `impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/` + +**Features**: +- Detect and upgrade POM format +- Update plugin versions +- Fix dependency issues +- Apply Maven 4 best practices +- Generate backup of original POMs + +**Usage**: +```bash +# Check what would be changed (dry-run) +mvn mvnup:help +mvn mvnup:upgrade + +# Run upgrade +mvn mvnup:upgrade --dry-run # Preview changes +mvn mvnup:upgrade # Apply changes +``` + +**Related Issues**: MNG-8765, #11001, #7934-#7938 + +### 3.2 Modular Sources + +**New POM Feature**: Support for JPMS-style modular project layouts. + +**Example**: +```xml +<project> + <sources> + <module>org.example.myapp</module> + <source> + <module>org.example.myapp</module> + <language>java</language> + <scope>main</scope> + <directory>src/${module}/${scope}/${language}</directory> + </source> + </sources> +</project> +``` + +**Automatically handles**: +- Module-aware source directories (`src/org.example.module/main/java`) +- Module-aware resource directories +- Duplicate detection with warnings +- Mixed modular/classic validation + +**Related Issue**: #11505 + +### 3.3 Profile Activation with Conditions + +**New Feature**: `<activation.condition>` element allows complex profile activation logic. + +**Example**: +```xml +<profile> + <activation> + <condition> + exists("${project.basedir}/src/main/java") && + System.getProperty("os.name").startsWith("Windows") + </condition> + </activation> +</profile> +``` + +**Features**: +- Boolean expressions +- Support for `${project.basedir}` +- Conditional operators (`&&`, `||`, `!`) +- Function calls (`exists()`, `missing()`, etc.) + +**Related Issue**: #11528 + +### 3.4 Enhanced Cache Architecture + +**New Features**: +1. **Hard Links**: Local repository uses hard links instead of copying files +2. **Configurable Reference Types**: `NONE`, `SOFT`, `WEAK`, `HARD` +3. **Cache Statistics**: Built-in tracking of hits/misses +4. **Per-entry reference types** + +**Configuration**: +```properties +# Enable cache statistics +maven.cache.stats=true + +# Configure reference types +maven.cache.keyValueRefs=SOFT +maven.cache.config=<?xml version="1.0"...> +``` + +**Related Issues**: #2506, #11354, #11222 + +### 3.5 SLF4J-based Logging + +**Change**: Complete logging rewrite using SLF4J. + +**Configuration**: +```properties +# Use new property names (not org.slf4j.simpleLogger.*) +maven.logger.level=INFO +maven.logger.io.level=DEBUG +maven.logger.log.prefix=/path/to/log.txt +``` + +**Features**: +- Flexible configuration +- Multiple logger implementations +- Better multi-threaded logging support +- JDK Platform Logging Integration (JEP 264) + +**Related Issues**: MNG-8503, MNG-8421, #11684 + +### 3.6 Dependency Management Transitivity + +**New Behavior**: +- Maven 4.0 **enables** transitivity for dependency management by default +- Maven 3.x ignored dependency management in transitive dependencies + +**Configuration**: +```properties +# Disable transitivity (Maven 3 behavior) +maven.dependency.transitivity=false + +# Enable transitivity (Maven 4 default, can be omitted) +maven.dependency.transitivity=true +``` + +**Impact**: Projects relying on Maven 3's transitive dependency management behavior may need adjustment. + +### 3.7 Consumer POMs + +**New Feature**: Ability to control consumer POM generation and flattening. + +**Configuration**: +```properties +# Disable flattening by default +maven.consumer.pom.flatten=false + +# Control whether to include consumer POMs in reactor +maven.consumer.pom.include=true +``` + +**Features**: +- Disabled by default (Maven 3 included them by default) +- Opt-in flattening +- Better control over what gets published + +### 3.8 BOM Packaging + +**New Feature**: Dedicated `bom` packaging type. + +**Example**: +```xml +<project> + <packaging>bom</packaging> +</project> +``` + +**Features**: +- Automatically transforms to `pom` in consumer POMs +- Preserves dependency versions in dependencyManagement +- Simplifies BOM project definitions + +**Related Issue**: #11427 + +--- + +## 4. Breaking Changes + +### 4.1 Java Version + +❌ **Breaking**: Minimum Java 17 (up from Java 8) + +**Migration**: +- Update build JDK to 17+ +- Update CI/CD configurations +- Check plugin compatibility with Java 17 + +### 4.2 Removed/Deprecated Classes + +**Removed** (from Maven 3): +- `org.apache.maven.model.mergeId` - deprecated in Maven 3.9 +- Various legacy interfaces (MNG-8750) + +**Deprecated** in Maven 4.0.0-rc-6: +- `InputLocation` constructors (use factory methods) +- `InputSource` constructors (use factory methods) + +**Example**: +```java +// OLD (deprecated in Maven 4.0.0-rc-6) +InputLocation loc = new InputLocation(1, 1, source); + +// NEW (recommended) +InputLocation loc = InputLocation.of(1, 1, source); +``` + +### 4.3 Logging Configuration + +❌ **Breaking**: Property names changed. + +```properties +# Maven 3 (no longer works) +org.slf4j.simpleLogger.log.org.apache.maven=INFO + +# Maven 4.0 (new syntax) +maven.logger.level=INFO +maven.logger.io.level=DEBUG +``` + +### 4.4 Dependency Management Transitivity + +⚠️ **Behavior Change**: Dependency management now works transitively. + +```properties +# To get Maven 3 behavior in Maven 4.0: +maven.dependency.transitivity=false +``` + +### 4.5 Consumer POMs + +⚠️ **Behavior Change**: Consumer POMs not included by default. + +```properties +# To get Maven 3 behavior (include consumer POMs): +maven.consumer.pom.include=true + +# To enable flattening (Maven 3 behavior): +maven.consumer.pom.flatten=true +``` + +--- + +## 5. New Configuration Properties + +Maven 4.0 introduces many new configuration properties: + +### 5.1 System Properties + +| Property | Default | Description | +|----------|---------|-------------| +| `maven.dependency.transitivity` | `true` | Enable dependency management transitivity | +| `maven.consumer.pom.flatten` | `false` | Flatten consumer POMs | +| `maven.consumer.pom.include` | `true` | Include consumer POMs | +| `maven.deploy.buildPom` | `true` | Deploy build POM alongside consumer POM | +| `maven.builder.maxProblems` | `100` | Maximum problems to collect | + +### 5.2 Logging Properties + +| Property | Default | Description | +|----------|---------|-------------| +| `maven.logger.level` | `INFO` | Root logger level | +| `maven.logger.io.level` | `DEBUG` | I/O logger level | +| `maven.logger.log.prefix` | - | Log output prefix | +| `maven.logger.stdout.level` | `INFO` | Stdout logger level | +| `maven.logger.stderr.level` | `ERROR` | Stderr logger level | + +### 5.3 Cache Properties + +| Property | Default | Description | +|----------|---------|-------------| +| `maven.cache.stats` | `false` | Display cache statistics at build end | +| `maven.cache.config` | - | Cache configuration file | +| `maven.cache.keyValueRefs` | `SOFT` | Key reference type | +| `maven.cache.cacheValueRefs` | `SOFT` | Value reference type | + +### 5.4 Resolver Properties + +| Property | Default | Description | +|----------|---------|-------------| +| `maven.resolver.transport` | `default` | Transport provider | +| `maven.resolver.localRepository` | `${user.home}/.m2/repository` | Local repo location | + +--- + +## 6. Compatibility Considerations + +### 6.1 Maven 3.9 Plugins + +**Good News**: Most Maven 3.9 plugins should work with Maven 4.0 due to: +- `compat` layer providing legacy APIs +- Maven 3.9 toolchain support explicitly registered + +**Potential Issues**: +- Plugins using removed internal classes +- Plugins with specific Maven 3 assumptions +- Plugins with broken dependency management usage + +### 6.2 Maven 4.0-Ready Plugins + +Plugins updated for Maven 4.0 will: +- Use `api` layer classes +- Support Java 17 +- Use SLF4J-based logging +- Leverage new dependency transitivity + +### 6.3 Extension Compatibility + +**Maven 3.X Extensions**: +- Continue to work via `compat` layer +- Benefit from Maven 4 features automatically + +**Maven 4.0 Extensions**: +- Should use new `maven-api` classes +- Can use Sisu annotations (`@Inject`, `@Named`) +- Can access new features (modular sources, etc.) + +--- + +## 7. Performance Improvements + +### 7.1 Hard Links in Local Repository + +**Improvement**: Project local repository uses hard links instead of copying. + +**Benefits**: +- Faster multi-module builds +- Reduced disk I/O +- Less disk space usage +- Graceful fallback to copy if unsupported + +**Impact Speed**: Especially noticeable in large multi-module builds. + +### 7.2 Enhanced Caching + +**Improvement**: Configurable cache with reference types. + +**Benefits**: +- Better memory management +- Optional statistics for tuning +- Configurable retention policies (PERSISTENT, SESSION_SCOPED, REQUEST_SCOPED) + +### 7.3 Dependency Resolution Performance + +**Improvement**: Maven Resolver 2.0.14 (vs 1.9.x in Maven 3.9). + +| Version | Resolver | Notes | +|---------|----------|-------| +| Maven 3.9 | Resolver 1.9.x | - | +| Maven 4.0 | Resolver 2.0.14 | New API, improved performance | + +--- + +## 8. Directory Structure Changes + +### 8.1 Source Layout Changes + +``` +Maven 3.9 Maven 4.0 +├── maven-model ──────────────┬──> compat/maven-model (compat) +├── maven-core ──────────────┼──> impl/maven-core (impl) +├── maven-plugins ──────────────┤ +├── maven-settings ──────────────┼──> api/maven-api-settings (NEW) +├── maven-embedder ──────────────┼──> compat/maven-embedder (compat) +└── ... ──────────────┘ + + ┌──> api/ (NEW - Public API) + ├──> compat/ (NEW - Compatibility) + └──> impl/ (NEW - Implementation) +``` + +### 8.2 New Modules in Maven 4.0 + +**API Modules**: +- `maven-api-annotations` +- `maven-api-cli` +- `maven-api-core` +- `maven-api-di` +- `maven-api-model` +- `maven-api-metadata` +- `maven-api-plugin` +- `maven-api-settings` +- `maven-api-spi` +- `maven-api-toolchain` +- `maven-api-xml` + +**Impl Modules**: +- `maven-cli` (NEW CLIng) +- `maven-core` (refactored) +- `maven-di` +- `maven-executor` +- `maven-impl` +- `maven-jline` +- `maven-logging` + +**Compat Modules** (Maven 3.9 compatibility): +- `maven-artifact` +- `maven-builder-support` +- `maven-compat` +- `maven-embedder` +- `maven-model` +- `maven-model-builder` +- `maven-plugin-api` +- `maven-repository-metadata` +- `maven-resolver-provider` +- `maven-settings` +- `maven-settings-builder` +- `maven-toolchain-builder` +- `maven-toolchain-model` + +--- + +## 9. Migration Guide + +### 9.1 Pre-Migration Checklist + +- [ ] Ensure Java 17+ available +- [ ] Review build configuration for removed features +- [ ] Test critical plugins with Maven 4.0 RC +- [ ] Review dependency management usage +- [ ] Check custom logging configuration +- [ ] Test with sample project + +### 9.2 Step-by-Step Migration + +**Step 1: Test with Maven 4.0 RC** + +```bash +# Download Maven 4.0.0-rc-5+ +curl -O https://downloads.apache.org/maven/maven-4/4.0.0-rc-5/binaries/apache-maven-4.0.0-rc-5-bin.tar.gz +tar -xzf apache-maven-4.0.0-rc-5-bin.tar.gz +export PATH="$PWD/apache-maven-4.0.0-rc-5/bin:$PATH" + +# Test with your project +mvn clean verify +``` + +**Step 2: Fix Java Version Issues** + +```xml +<!-- Update pom.xml if needed --> +<properties> + <maven.compiler.source>17</maven.compiler.source> + <maven.compiler.target>17</maven.compiler.target> +</properties> +``` + +**Step 3: Update Logging Configuration** + +Convert from: +```properties +org.slf4j.simpleLogger.log.org.apache.maven.cli=INFO +``` + +To: +```properties +maven.logger.level=INFO +``` + +**Step 4: Review Dependency Management** + +If you relied on non-transitive dependency management: + +```properties +# Add to Maven configuration +maven.dependency.transitivity=false +``` + +**Step 5: Run Maven Upgrade Tool** + +```bash +# Preview changes +mvn mvnup:upgrade --dry-run + +# Apply changes +mvn mvnup:upgrade +``` + +**Step 6: Fix Deprecation Warnings** + +Update deprecated API usage: +```java +// Before +InputLocation loc = new InputLocation(1, 1, source); + +// After +InputLocation loc = InputLocation.of(1, 1, source); +``` + +**Step 7: Test Thoroughly** + +```bash +# Full build test +mvn clean install -Prun-its + +# Verify generated artifacts +mvn verify +``` + +**Step 8: Update CI/CD** + +- Update Maven version in CI config +- Update Java version to 17 or 21 +- Update any hardcoded paths +- Test in CI environment + +**Step 9: Update Team Documentation** + +- Update build instructions +- Document new features being used +- Update dependency management docs +- Note any Maven 4-specific configurations + +**Step 10: Rollout** + +- Update local development environments +- Update CI/CD pipelines +- Update deployment scripts +- Monitor for issues + +--- + +## 10. Common Issues and Solutions + +### 10.1 Java Version Errors + +**Error**: `Unsupported class file major version 61 (Java 17)` + +**Solution**: Ensure you're using Java 17 or higher: +```bash +java -version # Should show 17+ +``` + +### 10.2 Plugin Not Found + +**Error**: Plugin fails with `NoSuchMethodError` or `ClassNotFoundException` + +**Solution**: +1. Check plugin version compatibility +2. Update to latest plugin version +3. Report issue if needed + +### 10.3 Logging Configuration Ignored + +**Issue**: Old property names don't work + +**Solution**: Convert to new property names: +```properties +# Remove old properties +# org.slf4j.simpleLogger.log.org.apache.maven=INFO + +# Add new properties +maven.logger.level=INFO +``` + +### 10.4 Dependency Management Differences + +**Issue**: Different dependency resolution or transitive dependencies + +**Solution**: +1. Review dependency management usage +2. If Maven 3 behavior needed: `maven.dependency.transitivity=false` +3. Adjust dependency scopes if needed + +### 10.5 Consumer POM Issues + +**Issue**: Missing or different consumer POMs + +**Solution**: +```properties +# To include consumer POMs +maven.consumer.pom.include=true + +# To flatten consumer POMs +maven.consumer.pom.flatten=true +``` + +--- + +## 11. Major Features Deep Dive + +### 11.1 Dependency Injection with Sisu + +**Maven 3.9**: Plexus-based DI +**Maven 4.0**: Sisu-based DI (JSR-330 compliant) + +**Example**: +```java +// Maven 4.0 Extension +import jakarta.inject.Inject; +import jakarta.inject.Named; +import jakarta.inject.Singleton; +import org.apache.maven.api.di.Named; // Use Maven's annotations + +@Singleton +@Named("myService") +public class MyService { + + @Inject + public MyService(ArtifactResolver resolver) { + this.resolver = resolver; + } +} +``` + +### 11.2 New Model API + +**Key Classes**: + +```java +// Artifact +Artifact artifact = Artifact.builder() + .groupId("org.example") + .artifactId("myapp") + .version("1.0.0") + .type("jar") + .build(); + +// Dependency +Dependency dependency = Dependency.builder() + .artifact(artifact) + .scope(Scope.COMPILE) + .build(); + +// SourceRoot +SourceRoot sourceRoot = SourceRoot.builder() + .language(Language.JAVA) + .scope(ProjectScope.MAIN) + .directory(Paths.get("src/main/java")) + .build(); +``` + +### 11.3 Service API + +**Using Services**: + +```java +// In extension or plugin +@Inject + private ArtifactResolver artifactResolver; + +public void myMethod() { + ArtifactResolverRequest request = ArtifactResolverRequest.builder() + .artifact(Artifact.builder() + .groupId("org.example") + .artifactId("myapp") + .version("1.0.0") + .build()) + .repositories(repositories) + .build(); + + ArtifactResolverResult result = artifactResolver.resolve(request); +} +``` + +--- + +## 12. Testing for Maven 4.0 Compatibility + +### 12.1 Integration Test Tips + +```xml +<plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-verifier-plugin</artifactId> + <version>...</version> + <configuration> + <!-- Test with both Maven 3.9 and 4.0 --> + <mavenVersion>[3.9.12,4.0.0)</mavenVersion> + </configuration> +</plugin> +``` + +### 12.2 Checklist for Plugin Developers + +- [ ] Update to Java 17 +- [ ] Test with Maven 4.0 RC +- [ ] Check for deprecated API usage +- [ ] Update dependency injection (if using Plexus directly) +- [ ] Support new logging configuration +- [ ] Handle dependency management changes +- [ ] Add CI tests for both Maven 3.9 and 4.0 +- [ ] Update documentation + +--- + +## 13. Release History + +### 13.1 Maven 4.0 Roadmap + +| Milestone | Date | Notes | +|-----------|------|-------| +| Alpha 1-13 | 2023-2024 | Early development | +| Beta 2-5 | 2024 | Feature complete | +| RC-1 | 2025-10 | First release candidate | +| RC-2 | 2025-10 | Bug fixes | +| RC-3 | 2025-10 | Additional fixes | +| RC-4 | 2025-10 | Logging fixes | +| RC-5 | 2025-11-07 | Stability release | +| **RC-6 (planned)** | **2026-Q1** | **Final release candidate** | +| **4.0.0 (final)** | **TBD** | **Pending RC-6 validation** | + +### 13.2 Key Milestones in Development + +- ~2022: Maven 4 development started +- 2022-2023: API layer design +- 2023-2024: Implementation rewrite +- 2024: Feature freeze +- 2025: Release candidates +- 2026: Final release + +--- + +## 14. Resources + +### 14.1 Documentation + +- [Maven 4.0 Documentation](https://maven.apache.org/ref/4.0.0/) +- [Migration Guide](https://maven.apache.org/docs/4.0.0/release-notes.html) +- [API Javadoc](https://maven.apache.org/ref/4.0.0/apidocs/) + +### 14.2 Source Code + +- Apache Maven Repository: https://github.com/apache/maven +- Maven 4.0.x branch: https://github.com/apache/maven/tree/maven-4.0.x +- Maven 3.9.x branch: https://github.com/apache/maven/tree/maven-3.9.x + +### 14.3 Issue Tracking + +- Issue Tracker: https://github.com/apache/maven/issues +- Mailing Lists: https://maven.apache.org/mailing-lists.html + +--- + +## 15. Quick Reference + +### 15.1 Version Comparison + +| Feature | Maven 3.9 | Maven 4.0 | +|---------|-----------|----------| +| Java | 8+ | 17+ | +| API | org.apache.maven | org.apache.maven.api (new) | +| Logging | SLF4J with simple config | Enhanced SLF4J API | +| DI | Plexus | Sisu (JSR-330) | +| Modular Sources | ❌ | ✅ | +| Profile Conditions | ❌ | ✅ | +| mvnup tool | ❌ | ✅ | +| Hard links | ❌ | ✅ | +| BOM packaging | ❌ | ✅ | +| Dependency Mgmt Transitivity | ❌ | ✅ | +| Cache Reference Types | Limited | Configurable (SOFT/WEAK/HARD) | +| Consumer POM Flattening | ✅ default | ⚠️ opt-in | + +### 15.2 Property Migration + +| Maven 3.9 Property | Maven 4.0 Property | Notes | +|--------------------|--------------------|-------| +| `org.slf4j.simpleLogger.*` | `maven.logger.*` | Name prefix changed | +| N/A | `maven.dependency.transitivity` | New feature | +| N/A | `maven.consumer.pom.*` | New feature | +| N/A | `maven.cache.*` | New feature | + +### 15.3 Package Migration + +| Maven 3.9 | Maven 4.0 | Status | +|-----------|----------|--------| +| `org.apache.maven.*` | Same | ✅ compat layer | +| `org.apache.maven.api.*` | New | ✅ added | +| `org.apache.maven.cli.*` | `org.apache.maven.cling.*` | ⚠️ changed | +| SLF4J simple config | Enhanced SLF4J | ⚠️ config changes | + +--- + +## 16. Summary + +Maven 4.0 represents a **major evolution** of Apache Maven with: + +### Advantages +- ✅ Modern, clean architecture +- ✅ Public API for extensions +- ✅ Java 17 support for modern features +- ✅ Performance improvements (hard links, caching) +- ✅ New features (modular sources, profile conditions) +- ✅ Automated upgrade tool (`mvnup`) +- ✅ SLF4J integration +- ✅ Better dependency management + +### Considerations +- ⚠️ Java 17 minimum requirement +- ⚠️ Some behavior changes (dependency transitivity, consumer POMs) +- ⚠️ New property names for configuration +- ⚠️ Some deprecated APIs + +### Recommendations +1. **Test first** with Maven 4.0 RC +2. **Use mvnup** for automated project upgrades +3. **Review** dependency management usage +4. **Update** logging configuration +5. **Plan** for Java 17 upgrade +6. **Monitor** for plugin compatibility issues + +--- + +**Generated on**: February 6, 2026 +**Baseline Maven**: 3.9.12 +**Target Maven**: 4.0.0-SNAPSHOT (maven-4.0.x branch) +**Total Analysis**: ~5,293 commits, 10,787 changed files, +483K/-100K lines \ No newline at end of file diff --git a/maven-4.0.x-since-rc-5-analysis.md b/maven-4.0.x-since-rc-5-analysis.md new file mode 100644 index 0000000000..b108ca5345 --- /dev/null +++ b/maven-4.0.x-since-rc-5-analysis.md @@ -0,0 +1,489 @@ +# Maven 4.0.x: Changes Since RC-5 + +**Analysis Date**: February 6, 2026 +**Baseline**: `maven-4.0.0-rc-5` (November 7, 2025) +**Current**: `origin/maven-4.0.x` (4.0.0-SNAPSHOT) +**Commits**: 76 commits since RC-5 + +--- + +## Summary Statistics + +| Metric | Value | +|--------|-------| +| Total commits | 76 | +| Total files changed | 150 | +| Lines added | 3,141 | +| Lines deleted | 667 | +| Net change | +2,474 lines | +| Commits between release candidates | ~6 weeks | + +--- + +## 1. API Changes (org.apache.maven.api) + +### 1.1 Major API Additions + +**`ModelBuilderResult`** (api/maven-api-core): +**New Methods**: +```java +// Get profiles for a specific model in hierarchy +List<Profile> getActivePomProfiles(String modelId); + +// Get all active profiles organized by model ID +Map<String, List<Profile>> getActivePomProfilesByModel(); +``` + +**Purpose**: This addresses **GH-11409** - profile source tracking in multi-module projects. The API now supports tracking which profiles came from which model (parent vs child), matching Maven 3 behavior. + +### 1.2 InputLocation/InputSource Factory Methods + +**`InputLocation`** (api/maven-api-model): +- **Made class `final`** - prevents subclassing +- **Deprecated all constructors** with `@Deprecated(since="4.0.0-rc-6")` +- **Added static factory methods**: `of(...)` + - `of(InputSource source)` + - `of(int lineNumber, int columnNumber)` + - `of(int line, int col, InputSource source)` + - `of(int line, int col, InputSource source, Object selfLocationKey)` + - `of(int line, int col, InputSource source, Map<Object, InputLocation> locations)` + +**Backward Compatibility**: Constructors remain public (just deprecated) to maintain compatibility with extensions like mason. + +**Reason**: This brings API consistency with master (4.1.0-SNAPSHOT) while maintaining backward compatibility. + +**Commit**: `aec75941db` - Add InputLocation/InputSource factory methods for 4.0.0-rc-6 (#11538) + +--- + +## 2. Implementation Changes (impl/) + +### 2.1 Hard Links for Local Repository (Performance Improvement) + +**File**: `impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java` + +**Change**: Project local repository now uses **hard links** instead of copying artifact files from reactor projects. + +**Before**: +```java +Files.copy(artifact.getPath(), target, + StandardCopyOption.REPLACE_EXISTING, + StandardCopyOption.COPY_ATTRIBUTES); +``` + +**After**: +```java +// Try to create hard link first +Files.deleteIfExists(target); +Files.createLink(target, source); +// Fallback to copy if unsupported +Files.copy(source, target, ...); +``` + +**Benefits**: +- **Significant speed improvement** for multi-module builds +- **Reduced disk I/O** - files aren't duplicated +- **Graceful fallback** - if hard links aren't supported, falls back to copy + +**Commit**: `87ff342a16` - Use hard links for artifact files (#11550) + +### 2.2 Profile Source Tracking (Bug Fix) + +**Files Changed**: +- `impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java` +- `impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilderResult.java` +- `impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java` + +**Problem (GH-11409)**: +- `ModelBuilderResult.getActivePomProfiles()` returned all active profiles as a flat list +- No tracking of which model each profile came from +- Profile sources showing incorrect information in multi-module projects + +**Solution**: +- Changed internal storage from `List<Profile>` to `Map<String, List<Profile>>` +- Tracks model IDs using `groupId:artifactId:version` format (without packaging) +- Added new methods to retrieve profiles by model +- Updated DefaultProjectBuilder to use per-model profile tracking + +**Integration Test Added**: `MavenITgh11409ProfileSourceTest.java` + +**Commit**: `21a215c026` - Fix profile source tracking (#11440) (#11466) + +### 2.3 Model Processor Error Reporting + +**File**: `impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java` + +**Improvement**: Better error messages when alternative model parsers fail to parse a POM. + +**Commit**: `71261c2948` - Improve DefaultModelProcessor error reporting (#11529) + +### 2.4 FileSelector.matches() Fix (Bug Fix) + +**Issue**: `FileSelector.matches(Path)` returned incorrect results for files vs directories. + +**Commit**: `3dd76d0e48` - FileSelector.matches(Path) sometimes wrong (#11551) + +### 2.5 ConcurrentModificationException Fix (Bug Fix) + +**Issue**: Race condition causing `ConcurrentModificationException` in concurrent builds. + +**Commit**: `f471d7940b` - Fix a ConcurrentModificationException (#11429) + +### 2.6 Field Accessibility Leak Fix + +**File**: `impl/maven-impl/src/main/java/org/apache/maven/impl/di/EnhancedCompositeBeanHelper.java` + +**Issue**: Sensitive field accessibility leak potentially exposing private fields. + +**Commit**: `2bfdc6c2b8` - Fix field accessibility leak (#11425) (#11433) + +--- + +## 3. Model/POM Changes + +### 3.1 Profile Activation with ${project.basedir} (Enhancement) + +**File**: `impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java` + +**Change**: Allow `${project.basedir}` in `activation.condition` expressions. + +**Before**: `${project.basedir}` only allowed in `activation.file.exists` and `activation.file.missing`. + +**After**: Extended to `activation.condition` (Maven 4.0.0 new feature). + +**Example** (now works without warnings): +```xml +<profile> + <activation> + <condition>exists("${project.basedir}/src/main/java")</condition> + </activation> +</profile> +``` + +**Commit**: `fde721301c` - Allow ${project.basedir} in activation.condition (#11528) + +### 3.2 BOM Packaging in Consumer POMs (Bug Fix) + +**File**: `impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultConsumerPomBuilder.java` + +**Issues Fixed**: +1. **BOM packaging not transformed to POM** in consumer POMs + - 'bom' is not a valid packaging type in Maven 4.0.0 model + - Always transform to 'pom' in consumer POMs + +2. **Dependency versions not preserved** in dependencyManagement + - Resolved versions for dependencies in dependencyManagement now preserved + +**Integration Test Added**: `MavenITgh11427BomConsumerPomTest.java` + +**Commit**: `ba5c9a4ff1` - Fix BOM packaging in consumer POMs (#11427) (#11464) + +### 3.3 Java Module Name Support (Enhancement) + +**Change**: Accept Java module names as attached artifactId even if they differ from project's artifactId. + +**Example**: A project with artifactId `my-app` can now have an attached artifact with classifier named `com.example.myapp` (module name). + +**Commit**: `786e574064` - Accept Java module names as attached artifactId (#11573) + +--- + +## 4. Dependency Updates (pom.xml) + +| Dependency | RC-5 Version | Current Version | Change | +|------------|--------------|-----------------|--------| +| Maven Parent | 45 | 47 | v46, v47 | +| Maven Resolver | 2.0.13 | 2.0.14 | Upgrade | +| Logback Classic | 1.5.20 | 1.5.27 | +7 versions | +| ASM | 9.9 | 9.9.1 | Patch | +| Byte Buddy | 1.17.8 | 1.18.4 | +6 versions | +| Commons CLI | 1.10.0 | 1.11.0 | Minor | +| Plexus Interactivity | 1.4 | 1.5.1 | Minor | +| Plexus Interpolation | 1.28 | 1.29 | Patch | +| Plexus Testing | 2.0.1 | 2.1.0 | Minor | +| Plexus XML | 4.1.0 | 4.1.1 | Patch | +| Mockito | 5.20.0 | 5.21.0 | Patch | +| Mimir Testing | 0.10.4 | 0.11.2 | Minor | +| PMD Core | 7.18.0 | 7.21.0 | +3 versions | +| AssertJ | 3.27.6 | 3.27.7 | Patch | + +**Total dependency updates**: ~40 PRs for dependency bumps + +--- + +## 5. Documentation Changes + +### 5.1 JavaPathType Documentation + +**File**: `api/maven-api-core/src/main/java/org/apache/maven/api/JavaPathType.java` + +**Change**: Updated formatting and documentation wording for clarity ("module" in Maven sense → "subproject"). + +**Commit**: `d8777fd856` - Documentation fixes ("module" → "subproject") (#11548) + +### 5.2 Maven Repository Documentation + +**Change**: Clarified distinction between repository and deployment repository. + +**Commit**: `a6c85f15f1` - clarify repository vs deployment repository + +### 5.3 Maintained Branches + +**Files**: `.asf.yaml`, documentation + +**Change**: Added list of maintained branches to ASF configuration and docs. + +**Commit**: `a9b7231c17` - add maintained branches + +### 5.4 Javadoc Package Groups + +**Change**: Fixed javadoc group packages and links. + +**Commit**: `1eac14b509` - fix javadoc group packages + +### 5.5 Prerequisites Error Message + +**Change**: Updated formatting of prerequisites-requirements error for better readability. + +**Commit**: `a20e3a1a30` - Update formatting of prerequisites-requirements error + +### 5.6 DOAP File Update + +**File**: `doap_Maven.rdf` + +**Change**: Added Maven 4.0.0-rc-5 release to DOAP description of a project (DOAP) file. + +**Commit**: `86bbdd6d28` - Add Maven 4.0.0-rc-5 release to DOAP file + +--- + +## 6. Build Configuration Changes + +### 6.1 GitHub Actions Updates + +**Files**: `.github/workflows/maven.yml`, `.github` config files + +**Changes**: +- Bump actions/* packages versions +- Update action version in comments +- Add/adjust release-drafter configuration for 6.2.0 + +**Affected Actions**: checkout, setup-java, cache, upload-artifact, download-artifact + +### 6.2 Mimir Mirror Feature + +**Change**: Use Mimir mirror feature for repository mirroring. + +**Commit**: `d11449dd0b` - Use Mimir mirror feature (#11622) (#11631) + +--- + +## 7. Test Improvements + +### 7.1 New Integration Tests + +| Test Class | Issue Fixed | Purpose | +|------------|-------------|---------| +| `MavenITgh11409ProfileSourceTest` | GH-11409 | Profile source tracking in multi-module | +| `MavenITgh11427BomConsumerPomTest` | GH-11427 | BOM packaging in consumer POMs | + +### 7.2 Test Resources + +**New Test Projects**: +- `gh-11409/pom.xml` - Multi-module profile source tracking test +- `gh-11409/subproject/pom.xml` - Subproject for profile tests +- `gh-11427-bom-consumer-pom/` - BOM consumer POM test structure +- `profile-activation-condition-with-basedir.xml` - Profile activation test + +### 7.3 Test Code Refactoring + +- Added names to ModelParsers (then reverted in `37cb067aec`) +- Updated multi-threaded file activation test for new profile tracking + +--- + +## 8. Breaking Changes + +### Minimal Breaking Changes + +The changes since RC-5 are **mostly backward compatible**: + +1. **InputLocation constructors deprecated** - remain public, just deprecated +2. **New API methods added** - no existing methods removed +3. **Dependency updates** - all minor/patch versions, no breaking changes + +### Impact Assessment + +| Area | Impact | User Action Required | +|------|--------|----------------------| +| Extensions/Plugins | Low | InputLocation constructors deprecated, but still work | +| Profile Activation | None | Enhancement - allows more expressions | +| BOM Projects | None | Bug fix - transforms packaging automatically | +| Local Repository | None | Performance improvement - transparent | +| Multi-module builds | None | Bug fix - better profile tracking | + +--- + +## 9. Commits by Category + +### 9.1 Functional Changes (non-dependency) + +| Type | Count | % | +|------|-------|---| +| Bug Fixes | 6 | 7.9% | +| Performance Improvements | 1 | 1.3% | +| API Additions | 2 | 2.6% | +| Enhancements | 3 | 3.9% | +| Documentation | 8 | 10.5% | +| Build Config | 4 | 5.3% | +| Test Updates | 5 | 6.6% | +| **Non-Dependency Total** | **29** | **38.2%** | + +### 9.2 Dependency Updates + +| Type | Count | % | +|------|-------|---| +| Maven Dependencies | 15 | 19.7% | +| Plexus Dependencies | 6 | 7.9% | +| Testing Dependencies | 4 | 5.3% | +| GitHub Actions | 12 | 15.8% | +| Other Dependencies | 10 | 13.2% | +| **Dependency Total** | **47** | **61.8%** | + +--- + +## 10. Issues Fixed + +| Issue | Type | Commit | +|-------|------|--------| +| GH-11409 | Bug | Profile source tracking in multi-module projects | +| GH-11427 | Bug | BOM packaging in consumer POMs | +| GH-11485, GH-11486, GH-11363 | Bug | Special characters in .mvn/jvm.config | +| GH-11125 | Enhancement | Simplify "**" handling using brace expansion | +| GH-11153 | Enhancement | Search module-info.class in META-INF/versions/ | +| GH-11528 | Enhancement | Allow ${project.basedir} in activation.condition | +| GH-11550 | Performance | Use hard links for local repository | +| GH-11551 | Bug | FileSelector.matches(Path) issues | +| GH-11572 | Dependency | Bump ASM to 9.9.1 | +| GH-11573 | Enhancement | Accept Java module names as artifactId | +| GH-11573 | Feature | Module names as attached artifactId | + +--- + +## 11. Readiness for Final Release + +### 11.1 Release Timeline + +- **RC-5**: November 7, 2025 +- **Current (4.0.0-SNAPSHOT)**: February 6, 2026 (~91 days later) +- **Commits since RC-5**: 76 + +### 11.2 Release Readiness Assessment + +| Criterion | Status | Notes | +|-----------|--------|-------| +| **Bug Fixes** | ✅ Good | 6 significant bug fixes backported | +| **API Stability** | ✅ Excellent | Only additive changes, deprecated constructors | +| **Breaking Changes** | ✅ None | All changes backward compatible | +| **Performance** | ✅ Improved | Hard links for local repository | +| **Test Coverage** | ✅ Good | 2 new integration tests | +| **Documentation** | ✅ Current | Various doc improvements | +| **Dependencies** | ✅ Stable | All minor/patch updates | + +### 11.3 Recommendation + +**Ready to Release RC-6** as final release candidate: + +**Rationale**: +1. **All bugs are fixed** - significant issues (GH-11409, GH-11427) resolved +2. **No breaking changes** - fully backward compatible with RC-5 +3. **Performance improved** - hard links for faster builds +4. **API stable** - deprecated constructors still work, no removals +5. **Dependency updates** - all minor/patch, no major version bumps +6. **~91 days since RC-5** - reasonable stabilization period + +**Suggested Release Steps**: +1. Cut release branch from current `maven-4.0.x` +2. Tag as `maven-4.0.0-rc-6` +3. Run full test suite +4. If all tests pass, promote `maven-4.0.0-rc-6` to `maven-4.0.0` final + +--- + +## 12. Comparison: RC-5 → Current 4.0.x + +``` +maven-4.0.0-rc-5 + └─ [76 commits, 150 files, +3,141/-667 lines] + ├─ Bug Fixes (6) + │ ├─ GH-11409: Profile source tracking + │ ├─ GH-11427: BOM packaging in consumer POMs + │ ├─ GH-11363/11485/11486: Special chars in .mvn/jvm.config + │ ├─ FileSelector.matches() issues + │ ├─ ConcurrentModificationException + │ └─ Field accessibility leak + │ + ├─ Performance (1) + │ └─ Hard links for local repository + │ + ├─ API Additions (2) + │ ├─ InputLocation factory methods + │ └─ ModelBuilderResult per-model profile methods + │ + ├─ Enhancements (3) + │ ├─ ${project.basedir} in activation.condition + │ ├─ Java module name support as artifactId + │ └─ Mimir mirror feature + │ + └─ Dependency Updates (~47 PRs) + ├─ Logback 1.5.20 → 1.5.27 + ├─ Byte Buddy 1.17.8 → 1.18.4 + ├─ Commons CLI 1.10.0 → 1.11.0 + ├─ ASM 9.9 → 9.9.1 + └─ Various other minor updates + +origin/maven-4.0.x (4.0.0-SNAPSHOT) +``` + +--- + +## Appendix: All Commits Since RC-5 + +**Functional Changes (non-dependency)**: +1. `a50ae47f09` - Adjust release-drafter configuration +2. `fc30885e76` - Maven Parent 46 backport +3. `d11449dd0b` - Use Mimir mirror feature +4. `786e574064` - Accept Java module names as attached artifactId +5. `87ff342a16` - Use hard links for local repository +6. `d8777fd856` - Documentation fixes +7. `0437222533` - Maven 4.0.x w/ Resolver 2.0.14 +8. `3dd76d0e48` - FileSelector.matches() fix +9. `10da810a04` - Simplify "**" handling +10. `aec75941db` - InputLocation factory methods (rc-6) +11. `6c191d03ca` - Fix special chars in .mvn/jvm.config +12. `71261c2948` - Improve error reporting +13. `fde721301c` - Allow ${project.basedir} in activation.condition +14. `a20e3a1a30` - Update error message formatting +15. `37cb067aec` - Revert "Add names to ModelParsers" +16. `c5b83bf4b5` - Add names to ModelParsers +17. `a6c85f15f1` - Clarify repository vs deployment repository +18. `5e5d539383` - Use full GitHub action version in comments +19. `21a215c026` - Fix profile source tracking (GH-11409) +20. `ba5c9a4ff1` - Fix BOM packaging (GH-11427) +21. `1eac14b509` - Fix javadoc group packages +22. `40cca88c99` - Update links +23. `3592b42903` - Adapt documentation directories +24. `a9b7231c17` - Add maintained branches +25. `189e1c27f9` - Improve dependency graph rendering +26. `2bfdc6c2b8` - Fix field accessibility leak +27. `f471d7940b` - Fix ConcurrentModificationException +28. `81ae90836e` - Prepare for next development iteration + +**Dependency Updates**: ~47 PRs (logback, pmd, byte-buddy, commons-cli, etc.) + +--- + +**Generated on**: February 6, 2026 +**Baseline Tag**: maven-4.0.0-rc-5 +**Target Branch**: origin/maven-4.0.x +**Analyzing**: Changes between RC-5 and current maven-4.0.x branch \ No newline at end of file diff --git a/maven-4.0.x-vs-master-analysis.md b/maven-4.0.x-vs-master-analysis.md new file mode 100644 index 0000000000..8535cb14d8 --- /dev/null +++ b/maven-4.0.x-vs-master-analysis.md @@ -0,0 +1,407 @@ +# Maven 4.0.x vs Master Branch Analysis + +**Version Numbers:** +- **origin/maven-4.0.x**: `4.0.0-SNAPSHOT` (intended as final Maven 4.0 release) +- **origin/master**: `4.1.0-SNAPSHOT` (development toward Maven 4.1.0/4.2.0) + +--- + +## Overview Statistics + +| Metric | Value | +|--------|-------| +| Total files changed | 3,146 | +| Total additions | 18,755 lines | +| Total deletions | 16,216 lines | +| Files modified | 2,920 | +| Files added | 86 | +| Files deleted | 43 | +| Files renamed | ~68 | +| Commits unique to master | 329 | +| Commits unique to maven-4.0.x | 250 | + +--- + +## 1. API Changes (`org.apache.maven.api`) + +### Breaking Changes + +| File | Change | Impact | +|------|--------|--------| +| `api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocation.java` | **DELETED** | Replaced by `InputLocation` in `compat/maven-model` package | +| `api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocationTracker.java` | **DELETED** | Replaced by compat layer | +| `api/maven-api-model/src/main/java/org/apache/maven/api/model/InputSource.java` | **DELETED** | Replaced by compat layer | + +**Note**: These classes moved to `compat/maven-model` package as they're now considered legacy/compatibility APIs, not part of the experimental 4.0 API. + +### New API Features + +| Class | New Methods/Features | Since | +|-------|---------------------|-------| +| `ModelSource` | `String getModelId()` | 4.0.0 | +| `ProblemCollector` | `create(int, Predicate<P>)` with filtering | 4.0.0 | +| `Sources.resolvedSource()` | Parameter renamed `location` → `modelId` | 4.0.0 | +| `ModelObjectProcessor` | **NEW FILE** in api/maven-api-model | 4.1.0 | + +### Significant API Modifications + +**`Constants.java` (api/maven-api-core)**: +- Added `MAVEN_DEPLOY_BUILD_POM` property (4.1.0) +- Added cache configuration APIs (4.1.0): + - `MAVEN_CACHE_CONFIG_PROPERTY` + - `MAVEN_CACHE_STATS` + - `MAVEN_CACHE_KEY_REFS` + - `MAVEN_CACHE_VALUE_REFS` +- Documentation clarifications (Maven 2 vs 3 references) + +**Exception Classes** (all in `api/maven-api-core/services`): +- Removed `@Serial` fields and imports from ALL service exception classes: + - `ArtifactDeployerException` + - `ArtifactInstallerException` + - `ArtifactResolverException` + - `ChecksumAlgorithmServiceException` + - `DependencyResolverException` + - `InterpolatorException` + - `LookupException` + - `MavenException` + - `ModelBuilderException` + - `ProjectBuilderException` + - `PrompterException` + - `SettingsBuilderException` + - `SuperPomProviderException` + - `ToolchainManagerException` + - `ToolchainsBuilderException` + - `TransportProviderException` + - `VersionParserException` + - `VersionRangeResolverException` + - `VersionResolverException` + +--- + +## 2. Implementation Changes (`impl/`) + +### 2.1 Cache Architecture Overhaul + +**New Files Added** (`impl/maven-impl/src/main/java/org/apache/maven/impl/cache/`): +- `Cache.java` - New cache interface +- `CacheConfig.java` - Configuration with key/value reference types +- `CacheConfigurationResolver.java` - Settings-based configuration +- `CacheSelector.java` - Cache implementation selector +- `CacheSelectorParser.java` - Configuration parser +- `CacheStatistics.java` - Statistics tracking +- `PartialCacheConfig.java` - Partial configuration support + +**Files Deleted**: +- `SoftIdentityMap.java` - Replaced by new architecture + +**Key Improvements**: +- Multiple reference types: `NONE`, `SOFT`, `WEAK`, `HARD` +- Separate configuration for keys and values +- Comprehensive statistics (evictions by policy, hit/miss ratios) +- Shutdown hook to display cache statistics +- Better memory management with `ReferenceQueue` cleanup + +Related commits: +- `731700abc6` - Improve Maven cache architecture (#2506) +- `304791ec1c` - Consolidate caches (#11354) +- `9bc69624fc` - Rename cache keys (#11222) + +### 2.2 Project Builder Enhancements + +**New Files** (`impl/maven-core/src/main/java/org/apache/maven/project/`): +- `SourceHandlingContext.java` - Modular source tracking +- `SmartProjectComparator.java` - Critical path-based project ordering + +**Major Features**: + +1. **Modular Project Support** (SourceHandlingContext): + - Automatic detection of modular projects from `<sources>` configuration + - Duplicate source validation with warnings + - Mixed modular/classic source detection (ERROR) + - Module-aware resource injection for modular projects + - Legacy directory handling with appropriate warnings + +2. **Smart Build Ordering** (SmartProjectComparator): + - Critical path analysis for parallel builds + - Project weight calculation: `weight = 1 + max(downstream_weights)` + - Improves parallel build efficiency (similar to Takari Smart Builder) + +3. **Enhanced Error Reporting**: + - `ProjectBuildingException` now provides detailed problem summaries + - Per-project problem listings with source locations + - Fixed `"[unknown project]"` messages + +Related commits: +- `74ef127617` - Add module-aware resource handling (#11505) +- `f97bac3111` - Unify source tracking with SourceHandlingContext (#11632) +- `405e2e10fd` - Fix profile source tracking (#11440) + +### 2.3 CLI/mvnup Changes + +**XML Library Migration**: JDOM2 → DomTrip + +**Deleted Files** (`impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/`): +- `JDomUtils.java` (544 lines) - Replaced with DomUtils +- `GAVUtils.java` - Consolidated +- `UpgradeConstants.java` - Constants moved to library + +**New Files**: +- `DomUtils.java` - DomTrip-based XML utilities + +**Key Changes**: +- Pattern changes: + - `.getChild(name)` → `.child(name)` (returns `Optional`) + - `.getAttribute(name)` → `.attributeObject(name)` + - `.getRootElement()` → `.root()` +- Constants now from `eu.maveniverse.domtrip.maven.MavenPomElements` +- Maven 4.2.0 model support for upgrade tool + +Related commits: +- `a336a2c579` - Switch mvnup to domtrip (#11432) + +--- + +## 3. Model Version Updates + +| Version | POM Template | Location | +|---------|--------------|----------| +| 4.1.0 | `pom-4.1.0.xml` | Modified - adds xmlns namespace, modelVersion 4.1.0 | +| 4.2.0 | `pom-4.2.0.xml` | **NEW** - added template | + +**Schema Changes**: +- All versions (4.0.0+) use the same stable namespace: `http://maven.apache.org/POM/4.0.0` +- Version is specified in the `<modelVersion>` element +- XSD validation uses version-specific schema locations (e.g., `https://maven.apache.org/xsd/maven-4.1.0.xsd`) + +--- + +## 4. Dependency Changes (pom.xml) + +### New Dependencies: +```xml +<eu.maveniverse.maven.domtrip> + <domtrip.core.version>0.4.0</domtrip.core.version> + <domtrip.maven.version>0.4.0</domtrip.maven.version> +</eu.maveniverse.maven.domtrip> +``` + +### Version Upgrades: +- `junit` 5.13.4 → 6.0.2 +- `slf4j` integration added (SLF4J JDK Platform Logging) + +### Removed Dependencies: +- `org.jdom:jdom2` - Replaced by DomTrip +- `org.hamcrest:hamcrest` - Removed from dependencyManagement +- `org.assertj:assertj-core` - Removed from dependencyManagement +- `org.xmlunit:xmlunit-assertj` - Removed + +### Build Changes: +- Removed `maven-antrun-plugin` pre-site workaround +- Output timestamps updated +- Parent version changes tracked + +--- + +## 5. Functional Changes + +### New Features: + +1. **Cache Statistics**: + - Display cache statistics at build end via `maven.cache.stats=true` + - Track hits/misses by reference type + - Track evictions by retention policy + +2. **Source Handling**: + - Modular project detection + - Automatic resource injection for modular sources + - Duplicate source warnings + - Mixed modular/classic source errors + +3. **Build Optimization**: + - Smart project comparator for parallel builds + - Critical path-based project ordering + +4. **Logging**: + - SLF4J JDK Platform Logging Integration (JEP 264 support) + +5. **Build POM Deployment**: + - `maven.deploy.buildPom` property to control build POM deployment + +### Bug Fixes: + +- Profile source tracking in multi-module projects (#11440) +- Multiple SLF4J providers warning in tests (#11480) +- ConcurrentModificationException fix (#11428) +- NullPointerException when clearing project properties +- FileSelector.matches(Path) issues for files/directories (#11551) +- Special characters in `.mvn/jvm.config` (fix #11363, #11485, #11486) + +### Documentation: + +- README.md updates: + - Branch badges updated for 4.1.0, 4.0.x, and 3.9.x + - Distribution target path updated to 4.1.x-SNAPSHOT + - Jenkins and GitHub Actions badges for all branches + +- `.asf.yaml`: Added protected branches configuration + +- Added `cache-configuration.md` documentation + +--- + +## 6. Compatibility Layer Changes (`compat/`) + +| Package | Key Changes | +|---------|-------------| +| `maven-builder-support` | `DefaultProblem` updates, new factory test | +| `maven-compat` | Removed `maven-parent` dependency references, various test updates | +| `maven-model` | Added `InputLocation`, `InputSource` (moved from api layer) | +| `maven-model-builder` | Added `pom-4.2.0.xml`, updated `pom-4.1.0.xml` | +| `maven-model-builder` | Default settings validator updates | + +--- + +## 7. Test Infrastructure + +### New Test Projects (`impl/maven-core/src/test/projects/project-builder/`): +- `duplicate-enabled-sources/pom.xml` - Tests duplicate source warnings +- `mixed-sources/pom.xml` - Tests mixed modular/classic handling +- `modular-sources/pom.xml` - Tests modular source auto-detection +- `modular-sources-with-explicit-resources/pom.xml` - Tests resource injection +- `multiple-directories-same-module/pom.xml` - Tests module validation +- `sources-mixed-modules/pom.xml` - Tests multiple module sources + +### New Test Files: +- Java 17+ features tests (Stream.toList usage) +- Cache configuration tests +- Reference types tests +- SmartProjectComparator tests + +--- + +## 8. Risk Assessment for Renaming Strategy + +**Plan: Rename master → 4.x, maven-4.0.x → master** + +| Risk Area | Details | Mitigation | +|-----------|---------|------------| +| **API Stability** | Model classes moved from `api` to `compat` | API users should have been using compat layer since 4.0.0 RC | +| **Breaking Changes** | `SoftIdentityMap` removed in master | No breaking if 4.0.x released as is | +| **Version Difference** | 4.0.x → 4.1.0-rc1 (or 4.1.0) | Clear version bump signals new features | +| **Cache Architecture** | Complete redesign | Internal change, mostly transparent to users | +| **mvnup Tool** | XML library change (JDOM2→DomTrip) | Only affects upgrade tool users | +| **Model Versions** | 4.1.0 and 4.2.0 added | POM validation may need updates | + +**Recommendation**: The rename strategy is viable because: +1. Master has significant new features (4.1.0) that shouldn't block 4.0.0 release +2. All changes are additive or internal refactoring +3. API breaking changes are documented via version bump +4. Test coverage is comprehensive + +--- + +## 9. Key Commits Summary + +### Master → 4.0.x (329 commits): +- Cache architecture redesign (#2506, #11354, #11222) +- Modular sources support (#11505, #11632) +- Smart build ordering (#11632) +- SLF4J JDK integration (#11684) +- DomTrip migration (#11432) +- Model 4.2.0 support + +### 4.0.x → Master (250 commits): +- Dependency updates (logback, pmd, byte-buddy) +- Maven parent 46/47 updates +- Hard links for local repository (#11550) +- Mimir mirror features (both branches) + +--- + +## 10. Summary Diagram + +``` +maven-4.0.x (4.0.0-SNAPSHOT) +├── 4.0.0 release candidates stabilized +├── 250 unique commits (mostly dependency updates, backported features) +├── POM model 4.0.0 support +├── Cache: SoftIdentityMap based +├── mvnup: JDOM2 based +└── Goal: Final Maven 4.0 release + + ↓ (diverged from X where master is now) + +master (4.1.0-SNAPSHOT) +├── 329 unique commits (new features) +├── POM model 4.1.0 and 4.2.0 support +├── Cache: New architecture with reference types, statistics +├── Modularity: SourceHandlingContext, SmartProjectComparator +├── mvnup: DomTrip based +├── Dependencies: DomTrip added, JDOM2 removed +├── New features: +│ - Modular source handling +│ - Module-aware resources +│ - Smart build ordering +│ - Cache statistics +│ - SLF4J JDK integration +│ - Deploy build POM control +└── Goal: Maven 4.1.0/4.2.0 development +``` + +--- + +## Appendix: Full File Change List + +### Deleted API Files: +``` +D api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocation.java +D api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocationTracker.java +D api/maven-api-model/src/main/java/org/apache/maven/api/model/InputSource.java +``` + +### Added API Files: +``` +A api/maven-api-core/src/test/java/org/apache/maven/api/JavaPathTypeTest.java +A api/maven-api-core/src/test/java/org/apache/maven/api/feature/FeaturesTest.java +A api/maven-api-core/src/test/java/org/apache/maven/api/services/ModelSourceTest.java +A api/maven-api-model/src/main/java/org/apache/maven/api/model/ModelObjectProcessor.java +``` + +### Added Cache Files: +``` +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/Cache.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheConfig.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheConfigurationResolver.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelector.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheStatistics.java +A impl/maven-impl/src/main/java/org/apache/maven/impl/cache/PartialCacheConfig.java +``` + +### Deleted Implementation Files: +``` +D impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/GAVUtils.java +D impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtils.java +D impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/UpgradeConstants.java +D impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/GAVTest.java +D impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/JDomUtilsTest.java +D impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuildingResultWithLocationMatcher.java +D impl/maven-core/src/test/java/org/apache/maven/project/ProjectBuildingResultWithProblemMessageMatcher.java +D impl/maven-impl/src/main/java/org/apache/maven/impl/cache/SoftIdentityMap.java +D impl/maven-impl/src/main/java/org/apache/maven/impl/model/FileToRawModelMerger.java +D impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/ArtifactDescriptorReaderDelegate.java +``` + +### Added Implementation Files: +``` +A impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/DomUtils.java +A impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/goals/DomUtilsTest.java +A impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/SmartProjectComparator.java +A impl/maven-core/src/main/java/org/apache/maven/project/SourceHandlingContext.java +A src/site/markdown/cache-configuration.md +``` + +--- + +**Generated on**: February 6, 2026 +**Git branches analyzed**: origin/maven-4.0.x vs origin/master \ No newline at end of file diff --git a/src/mdo/writer-stax.vm b/src/mdo/writer-stax.vm index 9f12f7fc4e..dc9a1d0bfa 100644 --- a/src/mdo/writer-stax.vm +++ b/src/mdo/writer-stax.vm @@ -29,7 +29,7 @@ #else #set ( $ioVersion = $version ) #end -#set ( $namespace = $xmlModelMetadata.getNamespace($ioVersion) ) +#set ( $namespace = "http://maven.apache.org/POM/4.0.0" ) #set ( $schemaLocation = $xmlModelMetadata.getSchemaLocation($ioVersion) ) #set ( $rootXml = $Helper.xmlClassMetadata( $root ) ) #set ( $rootTag = $rootXml.tagName )
