Skip to content

Commit cf1fed4

Browse files
committed
Use Maven 4 as the runtime for m2eclipse
Maven 4 will soon be released and should be able to execute Maven 3 projects as well. We should therefore upgrade m2e to use Maven 4 from now on. For users that require Maven 3.9 line we can offer the latest 3.9.11 maven runtime as an additional install option like we already did for Maven 3.9.6
1 parent 984447e commit cf1fed4

File tree

53 files changed

+886
-220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+886
-220
lines changed

MAVEN4_UPGRADE_NOTES.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Maven 4 Upgrade Notes for m2e
2+
3+
This document describes the changes made to upgrade m2e's embedded Maven runtime from Maven 3.9.11 to Maven 4.0.0-rc-4.
4+
5+
## Compatibility Issues
6+
7+
- MavenCLI --> Constants
8+
- LifecycleExecutionPlanCalculator -> changed signatures
9+
- org.apache.maven.shared.utils.StringUtils -> replace
10+
- ReadonlyMavenExecutionRequest implements MavenExecutionReques --> needs to be part of runtime!
11+
- ExtensionResolutionException --> convert to plexus one helper method in runtime
12+
- ProjectSorter --> catch generic exception
13+
14+
15+
16+
## Changes Made
17+
18+
### 1. Maven Runtime Bundle (org.eclipse.m2e.maven.runtime)
19+
20+
#### Version Update
21+
- Updated `maven-core.version` from `3.9.11` to `4.0.0-rc-4`
22+
- Updated bundle version from `3.9.1100-SNAPSHOT` to `4.0.004-SNAPSHOT`
23+
24+
#### Dependency Changes
25+
26+
**Removed Dependencies:**
27+
- `org.fusesource.jansi:jansi` - Replaced with `org.jline:jansi-core` (Maven 4 uses JLine's jansi)
28+
- `org.apache.maven:maven-slf4j-provider` - Replaced with `org.apache.maven:maven-logging`
29+
- `org.apache.maven.resolver:maven-resolver-transport-http` - Replaced with `maven-resolver-transport-jdk`
30+
31+
**Added/Updated Dependencies:**
32+
- `org.apache.maven:maven-logging:4.0.0-rc-4` - New Maven 4 logging module
33+
- `org.apache.maven:maven-compat:4.0.0-rc-4` - Backward compatibility layer for Maven 3 APIs
34+
- `org.jline:jansi-core:3.30.4` - JLine's jansi implementation
35+
- `org.apache.maven.resolver:maven-resolver-transport-jdk:2.0.9` - Java 11+ HTTP client-based transport
36+
- Updated all resolver dependencies to version `2.0.9`
37+
- Updated `com.google.guava:failureaccess` to version `1.0.1`
38+
39+
#### Removed Source Files
40+
- `org.eclipse.m2e.slf4j2.provider.MavenSLF4JProvider` - No longer needed as Maven 4 provides its own SLF4J provider
41+
- `META-INF/services/org.slf4j.spi.SLF4JServiceProvider` - Service registration for the removed provider
42+
43+
#### BND Configuration Updates
44+
- Updated SLF4J binding jar name from `maven-slf4j-provider-${maven-core.version}.jar` to `maven-logging-${maven-core.version}.jar`
45+
46+
### 2. Runtime Target Platform (target-platform/m2e-runtimes.target)
47+
48+
- Updated to reference Maven runtime `3.9.1100.20241011-1318` from m2e release 2.2.1 for backward compatibility
49+
- This allows running tests with both Maven 3.9.11 and Maven 4.0.0-rc-4
50+
51+
### 3. Root POM (pom.xml)
52+
53+
- Updated maven.runtime dependency version from `3.9.1100-SNAPSHOT` to `4.0.004-SNAPSHOT`
54+
55+
## Maven 4 Architecture Changes
56+
57+
### New Modules in Maven 4
58+
Maven 4 introduces several new API modules:
59+
- `maven-api-core` - Core Maven 4 API
60+
- `maven-api-model` - Model API
61+
- `maven-api-plugin` - Plugin API
62+
- `maven-api-settings` - Settings API
63+
- `maven-api-toolchain` - Toolchain API
64+
- `maven-api-xml` - XML processing API
65+
- `maven-di` - Dependency injection module
66+
- `maven-impl` - Implementation module
67+
- `maven-jline` - JLine integration
68+
- `maven-logging` - Logging module (replaces maven-slf4j-provider)
69+
70+
### Backward Compatibility
71+
72+
Maven 4 provides the `maven-compat` module that maintains compatibility with Maven 3 APIs. This includes:
73+
- Support for Plexus Container API
74+
- Legacy Maven APIs from Maven 3.x
75+
- Compatibility layer for plugins built against Maven 3
76+
77+
## Code Compatibility Assessment
78+
79+
### PlexusContainer Usage
80+
81+
The following areas of m2e use PlexusContainer and related Plexus APIs:
82+
83+
1. **org.eclipse.m2e.core.internal.embedder.PlexusContainerManager**
84+
- Creates and manages PlexusContainer instances
85+
- Uses DefaultPlexusContainer, ContainerConfiguration
86+
- **Status**: Should work with maven-compat module
87+
88+
2. **org.eclipse.m2e.core.internal.embedder.IMavenPlexusContainer**
89+
- Interface for wrapping PlexusContainer
90+
- **Status**: Should work with maven-compat module
91+
92+
3. **Plexus Utility Classes**
93+
- `org.codehaus.plexus.util.xml.Xpp3Dom` - Used extensively for plugin configuration
94+
- `org.codehaus.plexus.util.dag.*` - DAG utilities for dependency ordering
95+
- `org.codehaus.plexus.util.Scanner` - Build context scanning
96+
- `org.codehaus.plexus.classworlds.ClassRealm` - ClassLoader management
97+
- **Status**: These are still available in Maven 4 (plexus-utils, plexus-classworlds)
98+
99+
4. **org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase**
100+
- Test utilities that lookup PlexusContainer
101+
- **Status**: Should work with maven-compat module
102+
103+
5. **org.eclipse.m2e.core.ui.internal.archetype.ArchetypePlugin**
104+
- Uses DefaultPlexusContainer for archetype operations
105+
- **Status**: Should work with maven-compat module
106+
107+
## Testing Requirements
108+
109+
The following areas should be tested to ensure Maven 4 compatibility:
110+
111+
### Core Functionality
112+
1. [ ] Project import from existing Maven projects
113+
2. [ ] POM editing and validation
114+
3. [ ] Dependency resolution
115+
4. [ ] Plugin execution during builds
116+
5. [ ] Workspace resolution
117+
6. [ ] Maven lifecycle execution
118+
7. [ ] External Maven launches
119+
120+
### PlexusContainer Compatibility
121+
1. [ ] Container creation and disposal
122+
2. [ ] Component lookup
123+
3. [ ] Extension loading from .mvn/extensions.xml
124+
4. [ ] ClassRealm management
125+
5. [ ] Plugin realm creation
126+
127+
### Build and Test Infrastructure
128+
1. [ ] Maven runtime bundle builds successfully
129+
2. [ ] All m2e modules compile against Maven 4 APIs
130+
3. [ ] Unit tests pass
131+
4. [ ] Integration tests pass
132+
5. [ ] UI tests pass
133+
134+
### Maven 4 Specific Features
135+
1. [ ] New Maven 4 API usage (if any)
136+
2. [ ] Maven 4 resolver transport (JDK HTTP client)
137+
3. [ ] Maven 4 logging integration with Eclipse
138+
4. [ ] Maven 4 dependency injection (Guice/Sisu)
139+
140+
## Known Issues and Limitations
141+
142+
### Build Environment
143+
- The current build requires access to repo.eclipse.org which may not be available in all environments
144+
- Tycho 4.0.13 may have issues with JavaSE-21 execution environment
145+
146+
### Potential API Changes
147+
The following Maven APIs may have changed between Maven 3 and Maven 4:
148+
1. **Resolver APIs** - Updated from 1.x to 2.x
149+
- New transport mechanism (JDK HTTP client vs Apache HttpClient)
150+
- May affect custom repository configurations
151+
152+
2. **Logging** - New maven-logging module
153+
- Uses SLF4J 2.x
154+
- May affect log filtering and configuration
155+
156+
3. **Plugin API** - New maven-api-plugin module
157+
- May affect plugin descriptor reading
158+
- May affect mojo parameter injection
159+
160+
## Recommendations
161+
162+
### Short Term
163+
1. Complete full build and test cycle to identify any runtime issues
164+
2. Test with real-world projects to validate Maven 4 compatibility
165+
3. Document any API incompatibilities found during testing
166+
4. Consider keeping Maven 3.9.11 runtime as an alternative for users
167+
168+
### Long Term
169+
1. Consider migrating to Maven 4 APIs where beneficial
170+
2. Deprecate Maven 3-specific workarounds that are no longer needed
171+
3. Take advantage of Maven 4's improved dependency injection
172+
4. Explore Maven 4's new features (e.g., build cache, consumer POM)
173+
174+
## References
175+
176+
- Maven 4.0.0-rc-4 Release: https://repo.maven.apache.org/maven2/org/apache/maven/maven/4.0.0-rc-4/
177+
- Maven Resolver 2.0.9: https://maven.apache.org/resolver/
178+
- Maven 4 Migration Guide: https://maven.apache.org/docs/4.0.0/

org.eclipse.m2e.apt.core/META-INF/MANIFEST.MF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Bundle-Name
44
Bundle-SymbolicName: org.eclipse.m2e.apt.core;singleton:=true
5-
Bundle-Version: 2.3.100.qualifier
5+
Bundle-Version: 2.3.200.qualifier
66
Bundle-Localization: plugin
77
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.27.0,4.0.0)",
88
org.eclipse.core.resources,
99
org.eclipse.jdt.core,
1010
org.eclipse.jdt.apt.core;bundle-version="3.7.50",
1111
org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)",
1212
org.eclipse.m2e.jdt;bundle-version="[2.0.0,3.0.0)",
13-
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,4.0.0)"
13+
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,5.0.0)"
1414
Eclipse-LazyStart: true
1515
Bundle-RequiredExecutionEnvironment: JavaSE-21
1616
Bundle-Vendor: %Bundle-Vendor
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-SymbolicName: org.eclipse.m2e.binaryproject.ui;singleton:=true
4-
Bundle-Version: 2.1.100.qualifier
4+
Bundle-Version: 2.1.200.qualifier
55
Bundle-Vendor: Eclipse.org - m2e
66
Bundle-Name: M2E Binary Project UI
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.runtime,
99
org.eclipse.m2e.core.ui;bundle-version="[2.0.0,3.0.0)",
1010
org.eclipse.m2e.binaryproject;bundle-version="[2.0.0,3.0.0)",
1111
org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)",
12-
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,4.0.0)"
12+
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,5.0.0)"
1313
Bundle-RequiredExecutionEnvironment: JavaSE-21
1414
Bundle-ActivationPolicy: lazy
1515
Automatic-Module-Name: org.eclipse.m2e.binaryproject.ui

org.eclipse.m2e.binaryproject/META-INF/MANIFEST.MF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-SymbolicName: org.eclipse.m2e.binaryproject;singleton:=true
4-
Bundle-Version: 2.2.100.qualifier
4+
Bundle-Version: 2.2.200.qualifier
55
Bundle-Vendor: Eclipse.org - m2e
66
Bundle-Name: M2E Binary Project Core
77
Require-Bundle: org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)",
8-
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,4.0.0)",
8+
org.eclipse.m2e.maven.runtime;bundle-version="[3.8.6,5.0.0)",
99
org.eclipse.m2e.sourcelookup;bundle-version="[2.0.0,3.0.0)",
1010
org.eclipse.m2e.jdt;bundle-version="[2.0.0,3.0.0)",
1111
org.eclipse.jdt.core;bundle-version="3.7.0",

org.eclipse.m2e.core.tests/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Bundle-SymbolicName: org.eclipse.m2e.core.tests
66
Bundle-Version: 2.0.0.qualifier
77
Bundle-RequiredExecutionEnvironment: JavaSE-21
88
Bundle-Vendor: Eclipse.org - m2e
9-
Require-Bundle: org.eclipse.m2e.tests.common,
9+
Require-Bundle: org.eclipse.m2e.maven.runtime;bundle-version="[4.0.0,5.0.0)",
10+
org.eclipse.m2e.tests.common,
1011
org.eclipse.core.runtime,
1112
org.eclipse.m2e.launching,
1213
org.eclipse.jdt.launching,
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Hello Maven 4 Test Project
2+
3+
## Overview
4+
This is a demonstration project showcasing Maven 4 features for testing m2e compatibility.
5+
6+
## Project Structure
7+
```
8+
HelloMaven4/
9+
├── pom.xml (parent)
10+
├── hello-core/ (library subproject)
11+
│ └── src/main/java/org/eclipse/m2e/tests/demo/core/
12+
│ └── GreetingService.java
13+
└── hello-app/ (application subproject)
14+
└── src/main/java/org/eclipse/m2e/tests/demo/app/
15+
└── HelloWorldApp.java
16+
```
17+
18+
## Maven 4 Features Used
19+
20+
This project demonstrates the following Maven 4 features from [What's New in Maven 4](https://maven.apache.org/whatsnewinmaven4.html):
21+
22+
### 1. ✅ New Model Version 4.1.0
23+
- **Feature**: Maven 4 introduces a new POM model version `4.1.0`
24+
- **Usage**: All POMs use `<modelVersion>4.1.0</modelVersion>` and `xmlns="http://maven.apache.org/POM/4.1.0"` namespace
25+
- **Location**: All `pom.xml` files
26+
- **Status**: Demonstrated
27+
28+
### 2. ✅ Subprojects Instead of Modules
29+
- **Feature**: Maven 4 uses `<subprojects>` instead of `<modules>` for better semantics
30+
- **Usage**: Parent POM uses `<subprojects>` to declare child projects
31+
- **Location**: `pom.xml` (parent)
32+
- **Status**: Demonstrated
33+
34+
### 3. ✅ Inheritance of GroupId and Version
35+
- **Feature**: Child projects can omit `<groupId>` and `<version>` when inheriting from parent
36+
- **Usage**: Child POMs (`hello-core` and `hello-app`) omit these elements
37+
- **Location**: `hello-core/pom.xml` and `hello-app/pom.xml`
38+
- **Status**: Demonstrated
39+
40+
### 4. ⏳ Build/Consumer POM Split
41+
- **Feature**: Maven 4 separates build-time and consumption-time concerns
42+
- **Usage**: Not explicitly demonstrated in this simple project
43+
- **Status**: Not applicable for this simple test case
44+
45+
### 5. ⏳ Better Java Version Handling
46+
- **Feature**: Improved handling of Java versions with `maven.compiler.release`
47+
- **Usage**: Uses `maven.compiler.release` property set to 11
48+
- **Location**: Parent POM properties
49+
- **Status**: Partially demonstrated
50+
51+
## Testing with Maven 4
52+
53+
This project is designed to be built with **Maven 4.0.0-rc-2** or later (Preview release).
54+
55+
To verify Maven 4 compatibility:
56+
```bash
57+
# Requires Maven 4.0.0-rc-2 or later
58+
mvn clean install
59+
```
60+
61+
## Purpose
62+
63+
This test project serves two main goals:
64+
65+
1. **Demonstrate Incompatibility**: Show that current m2e does NOT support Maven 4 features
66+
2. **Validation Target**: Provide a test case to verify Maven 4 support as it's implemented
67+
68+
## References
69+
70+
- [Apache Maven 4 Downloads](https://maven.apache.org/download.cgi)
71+
- [What's New in Maven 4](https://maven.apache.org/whatsnewinmaven4.html)
72+
- [Maven 4 Announcement](https://lists.apache.org/thread/jnb3snhdm4b564gz8hbctp9rfk8fc67n)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Maven 4 Subproject - demonstrates dependency on sibling subproject
4+
5+
This module also inherits groupId and version from parent
6+
-->
7+
<project xmlns="http://maven.apache.org/POM/4.1.0"
8+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
10+
11+
<modelVersion>4.1.0</modelVersion>
12+
13+
<parent>
14+
<groupId>org.eclipse.m2e.tests.demo</groupId>
15+
<artifactId>hello-maven4-parent</artifactId>
16+
<version>1.0.0-SNAPSHOT</version>
17+
</parent>
18+
19+
<artifactId>hello-app</artifactId>
20+
21+
<name>Hello Maven 4 App</name>
22+
<description>Application module demonstrating Maven 4 features</description>
23+
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.eclipse.m2e.tests.demo</groupId>
27+
<artifactId>hello-core</artifactId>
28+
<version>1.0.0-SNAPSHOT</version>
29+
</dependency>
30+
</dependencies>
31+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.eclipse.m2e.tests.demo.app;
2+
3+
import org.eclipse.m2e.tests.demo.core.GreetingService;
4+
5+
/**
6+
* Simple HelloWorld application demonstrating Maven 4 multi-subproject structure.
7+
*/
8+
public class HelloWorldApp {
9+
10+
public static void main(String[] args) {
11+
GreetingService service = new GreetingService();
12+
13+
String name = args.length > 0 ? args[0] : "Maven 4 World";
14+
String greeting = service.greet(name);
15+
16+
System.out.println(greeting);
17+
System.out.println("Built with Maven 4!");
18+
}
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Maven 4 Subproject - demonstrates inheritance of groupId and version
4+
5+
Note: In Maven 4, child projects can omit groupId and version
6+
when they inherit from parent, making the POM cleaner
7+
-->
8+
<project xmlns="http://maven.apache.org/POM/4.1.0"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
11+
12+
<modelVersion>4.1.0</modelVersion>
13+
14+
<parent>
15+
<groupId>org.eclipse.m2e.tests.demo</groupId>
16+
<artifactId>hello-maven4-parent</artifactId>
17+
<version>1.0.0-SNAPSHOT</version>
18+
</parent>
19+
20+
<artifactId>hello-core</artifactId>
21+
22+
<name>Hello Maven 4 Core</name>
23+
<description>Core library module demonstrating Maven 4 features</description>
24+
</project>

0 commit comments

Comments
 (0)