Skip to content

Commit fca5d73

Browse files
committed
Set maven main class property for latest maven 4
Latest Maven 4 uses a placeholder for the main class in the maven config file and currently m2e fails to add such installations. This now sets the property with a default value so m2e can parse the config again.
1 parent 66b65ce commit fca5d73

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Bundle-Name
44
Bundle-SymbolicName: org.eclipse.m2e.core;singleton:=true
5-
Bundle-Version: 2.7.1.qualifier
5+
Bundle-Version: 2.7.2.qualifier
66
Bundle-Activator: org.eclipse.m2e.core.internal.MavenPluginActivator
77
Bundle-Vendor: %Bundle-Vendor
88
Bundle-Localization: plugin

org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/launch/MavenExternalRuntime.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ public void setAppMain(String mainClassName, String mainRealmName) {
146146
}
147147
};
148148

149-
Properties properties = new Properties();
150-
copyProperties(properties, System.getProperties());
151-
properties.put(PROPERTY_MAVEN_HOME, getLocation());
152-
153-
ConfigurationParser parser = new ConfigurationParser(handler, properties);
149+
ConfigurationParser parser = new ConfigurationParser(handler, getConfigParserProperties());
154150

155151
try (FileInputStream is = new FileInputStream(getLauncherConfigurationFile())) {
156152
parser.parse(is);
@@ -261,12 +257,8 @@ public void setAppMain(String mainClassName, String mainRealmName) {
261257

262258
VersionHandler handler = new VersionHandler();
263259

264-
Properties properties = new Properties();
265-
copyProperties(properties, System.getProperties());
266-
properties.put(PROPERTY_MAVEN_HOME, getLocation());
267-
268260
try (FileInputStream is = new FileInputStream(getLauncherConfigurationFile())) {
269-
new ConfigurationParser(handler, properties).parse(is);
261+
new ConfigurationParser(handler, getConfigParserProperties()).parse(is);
270262
}
271263
if(handler.mavenCore != null) {
272264
return handler.mavenCore;
@@ -275,4 +267,13 @@ public void setAppMain(String mainClassName, String mainRealmName) {
275267
}
276268
return null;
277269
}
270+
271+
private Properties getConfigParserProperties() {
272+
Properties properties = new Properties();
273+
copyProperties(properties, System.getProperties());
274+
properties.put(PROPERTY_MAVEN_HOME, getLocation());
275+
properties.put("maven.mainClass", "org.apache.maven.cling.MavenCling"); //required for maven 4
276+
return properties;
277+
}
278+
278279
}

org.eclipse.m2e.feature/feature.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="org.eclipse.m2e.feature"
44
label="%featureName"
5-
version="2.8.0.qualifier"
5+
version="2.9.0.qualifier"
66
provider-name="%providerName"
77
plugin="org.eclipse.m2e.core"
88
license-feature="org.eclipse.license"

org.eclipse.m2e.sdk.feature/feature.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="org.eclipse.m2e.sdk.feature"
44
label="%featureName"
5-
version="2.8.1.qualifier"
5+
version="2.9.0.qualifier"
66
provider-name="%providerName"
77
license-feature="org.eclipse.license"
88
license-feature-version="0.0.0">

0 commit comments

Comments
 (0)