Skip to content

Commit e0b4bbd

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 e0b4bbd

File tree

79 files changed

+974
-312
lines changed

Some content is hidden

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

79 files changed

+974
-312
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/

m2e-parent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<groupId>org.eclipse.m2e</groupId>
1515
<artifactId>m2e-parent</artifactId>
16-
<version>2.1.0-SNAPSHOT</version>
16+
<version>3.0.0-SNAPSHOT</version>
1717
<packaging>pom</packaging>
1818

1919
<name>Maven Integration for Eclipse (parent)</name>

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

Lines changed: 4 additions & 4 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: 3.0.0.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",
11-
org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)",
12-
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)"
11+
org.eclipse.m2e.core;bundle-version="[3,4)",
12+
org.eclipse.m2e.jdt;bundle-version="[3,4)",
13+
org.eclipse.m2e.maven.runtime;bundle-version="[3.9,5)"
1414
Eclipse-LazyStart: true
1515
Bundle-RequiredExecutionEnvironment: JavaSE-21
1616
Bundle-Vendor: %Bundle-Vendor

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: m2e-apt Tests Plug-in
44
Bundle-SymbolicName: org.eclipse.m2e.apt.tests
5-
Bundle-Version: 2.0.0.qualifier
5+
Bundle-Version: 3.0.0.qualifier
66
Bundle-RequiredExecutionEnvironment: JavaSE-21
77
Require-Bundle: org.eclipse.m2e.tests.common,
88
org.junit,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Bundle-Name
44
Bundle-SymbolicName: org.eclipse.m2e.apt.ui;singleton:=true
5-
Bundle-Version: 2.0.600.qualifier
5+
Bundle-Version: 3.0.0.qualifier
66
Bundle-Localization: plugin
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.runtime,
99
org.eclipse.core.resources,
10-
org.eclipse.m2e.apt.core;bundle-version="[2.0.0,3.0.0)",
10+
org.eclipse.m2e.apt.core;bundle-version="[3,4)",
1111
org.eclipse.jdt.ui,
12-
org.eclipse.m2e.core;bundle-version="[2.0.0,3.0.0)"
12+
org.eclipse.m2e.core;bundle-version="[3,4)"
1313
Bundle-ActivationPolicy: lazy
1414
Bundle-RequiredExecutionEnvironment: JavaSE-21
1515
Bundle-Vendor: %Bundle-Vendor

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: M2E Binary Project Core Tests
44
Bundle-SymbolicName: org.eclipse.m2e.binaryproject.tests;singleton:=true
5-
Bundle-Version: 2.0.1.qualifier
5+
Bundle-Version: 3.0.0.qualifier
66
Bundle-Vendor: Eclipse.org - m2e
77
Require-Bundle: org.eclipse.m2e.core,
88
org.eclipse.m2e.maven.runtime,
Lines changed: 5 additions & 5 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: 3.0.0.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,
9-
org.eclipse.m2e.core.ui;bundle-version="[2.0.0,3.0.0)",
10-
org.eclipse.m2e.binaryproject;bundle-version="[2.0.0,3.0.0)",
11-
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)"
9+
org.eclipse.m2e.core.ui;bundle-version="[3,4)",
10+
org.eclipse.m2e.binaryproject;bundle-version="[3,4)",
11+
org.eclipse.m2e.core;bundle-version="[3,4)",
12+
org.eclipse.m2e.maven.runtime;bundle-version="[3.9,5)"
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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: 3.0.0.qualifier
55
Bundle-Vendor: Eclipse.org - m2e
66
Bundle-Name: M2E Binary Project Core
7-
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)",
9-
org.eclipse.m2e.sourcelookup;bundle-version="[2.0.0,3.0.0)",
10-
org.eclipse.m2e.jdt;bundle-version="[2.0.0,3.0.0)",
7+
Require-Bundle: org.eclipse.m2e.core;bundle-version="[3,4)",
8+
org.eclipse.m2e.maven.runtime;bundle-version="[3.9,5)",
9+
org.eclipse.m2e.sourcelookup;bundle-version="[3,4)",
10+
org.eclipse.m2e.jdt;bundle-version="[3,4)",
1111
org.eclipse.jdt.core;bundle-version="3.7.0",
1212
org.eclipse.core.runtime;bundle-version="[3.27.0,4.0.0)",
1313
org.eclipse.debug.core;bundle-version="3.9.0",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Fragment-Host: org.eclipse.m2e.core
33
Bundle-ManifestVersion: 2
44
Bundle-Name: M2E Maven Integration for Eclipse Core Tests
55
Bundle-SymbolicName: org.eclipse.m2e.core.tests
6-
Bundle-Version: 2.0.0.qualifier
6+
Bundle-Version: 3.0.0.qualifier
77
Bundle-RequiredExecutionEnvironment: JavaSE-21
88
Bundle-Vendor: Eclipse.org - m2e
99
Require-Bundle: org.eclipse.m2e.tests.common,

0 commit comments

Comments
 (0)