Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2018-08-31 10:10:02 -0400
committerFred Bricon2018-09-05 21:44:09 -0400
commitdb323d61161a055a1e5f200eada456650e2adddb (patch)
treed2a58421a9390ed5d1171436e9cc6dad45548823
parentc32dfdd1f8645b94065e0a12229eeac1bb2e6289 (diff)
downloadm2e-core-db323d61161a055a1e5f200eada456650e2adddb.tar.gz
m2e-core-db323d61161a055a1e5f200eada456650e2adddb.tar.xz
m2e-core-db323d61161a055a1e5f200eada456650e2adddb.zip
Bug 538461 : let MavenBuilder use a null scheduling rule
Added an experimental and semi-hidden preference to make the Maven builders scheduling rule null. The preference will be visible when Eclipse is started with the -Dm2e.showExperimentalFeatures=true flag (in eclipse.ini) Change-Id: Ieb231142368927ed9d138afa400f1ad1cec175a1 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java6
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties2
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenPreferencePage.java6
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMavenConfiguration.java8
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java8
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenConfigurationImpl.java6
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java7
8 files changed, 45 insertions, 0 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
index d1e5d1de..4cb6d17a 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/M2EUIPluginActivator.java
@@ -70,6 +70,8 @@ public class M2EUIPluginActivator extends AbstractUIPlugin {
private MavenUpdateConfigurationChangeListener mavenUpdateConfigurationChangeListener;
+ public static final String PROP_SHOW_EXPERIMENTAL_FEATURES = "m2e.showExperimentalFeatures";
+
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
@@ -156,4 +158,8 @@ public class M2EUIPluginActivator extends AbstractUIPlugin {
}
return null;
}
+
+ public static boolean showExperimentalFeatures() {
+ return Boolean.parseBoolean(System.getProperty(PROP_SHOW_EXPERIMENTAL_FEATURES));
+ }
}
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
index 1ba1ddbc..75178afe 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java
@@ -721,6 +721,8 @@ public class Messages extends NLS {
public static String preferencesDownloadJavadoc;
+ public static String preferencesNullSchedulingRule;
+
public static String artifactComponentArtifact;
public static String artifactComponentGroupId;
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
index 9811f250..9f2383c2 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties
@@ -419,6 +419,7 @@ preferencesGlobalChecksumPolicy_ignore=Ignore
preferencesGlobalChecksumPolicy_warn=Warn
preferencesGlobalChecksumPolicy_fail=Fail
preferencesReindexButton=Re&index
+preferencesNullSchedulingRule=Minimize lock during build. This is highly experimental and may corrupt build results\nand/or your local Maven repository.\nPlease report any issues to http://bugs.eclipse.org/538461.
projectSelectionDialogTitle=Select a Maven project
resolverConfigurationAdvanced=Ad&vanced
resolverConfigurationProfiles=&Profiles\:
@@ -488,3 +489,4 @@ wizardProjectPageProjectTitle=New Maven project
wizardProjectPageProjectValidatorInvalidLocation=Invalid project location path
wizardProjectPageProjectValidatorProjectLocation=Enter a location for the project.
wizardProjectTitle=New Maven Project
+
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenPreferencePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenPreferencePage.java
index 1aa6774f..56d60932 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenPreferencePage.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/MavenPreferencePage.java
@@ -105,6 +105,12 @@ public class MavenPreferencePage extends FieldEditorPreferencePage implements IW
Messages.preferencesGlobalChecksumPolicy_tooltip);
addField(checksumPolicy);
+ if(M2EUIPluginActivator.showExperimentalFeatures()) {
+ BooleanFieldEditor nullSchedulingRule = new BooleanFieldEditor(
+ MavenPreferenceConstants.P_BUILDER_USE_NULL_SCHEDULING_RULE, Messages.preferencesNullSchedulingRule,
+ getFieldEditorParent());
+ addField(nullSchedulingRule);
+ }
}
@Override
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMavenConfiguration.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMavenConfiguration.java
index 3f384dde..036c4b6d 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMavenConfiguration.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/embedder/IMavenConfiguration.java
@@ -117,4 +117,12 @@ public interface IMavenConfiguration {
* @since 1.7
*/
public String getOverridingManagedVersionExecutionSeverity();
+
+ /**
+ * @experimental This can cause builds to run in parallel, and m2e is not yet protected against parallel execution of
+ * Maven and its plugins (which is usually not supported).
+ * @return whether to use null as scheduling rule for builder.
+ */
+ public boolean buildWithNullSchedulingRule();
+
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
index e8fdcab6..2c165ace 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/builder/MavenBuilder.java
@@ -29,6 +29,7 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.apache.maven.project.MavenProject;
@@ -244,4 +245,11 @@ public class MavenBuilder extends IncrementalProjectBuilder implements DeltaProv
return new ArrayList<BuildDebugHook>(debugHooks);
}
}
+
+ public ISchedulingRule getRule(int kind, Map<String, String> args) {
+ if(MavenPlugin.getMavenConfiguration().buildWithNullSchedulingRule()) {
+ return null;
+ }
+ return super.getRule(kind, args);
+ }
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenConfigurationImpl.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenConfigurationImpl.java
index f6db5c01..bb453db0 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenConfigurationImpl.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenConfigurationImpl.java
@@ -327,4 +327,10 @@ public class MavenConfigurationImpl implements IMavenConfiguration, IPreferenceC
public void setAutomaticallyUpdateConfiguration(boolean value) {
preferencesLookup[0].putBoolean(MavenPreferenceConstants.P_AUTO_UPDATE_CONFIGURATION, value);
}
+
+ @Override
+ public boolean buildWithNullSchedulingRule() {
+ return Boolean.parseBoolean(
+ preferenceStore.get(MavenPreferenceConstants.P_BUILDER_USE_NULL_SCHEDULING_RULE, null, preferencesLookup));
+ }
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java
index c02db7b7..051f4066 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java
@@ -166,4 +166,11 @@ public interface MavenPreferenceConstants {
**/
public static final String P_AUTO_UPDATE_CONFIGURATION = PREFIX + "autoUpdateProjects"; //$NON-NLS-1$
+ /**
+ * boolean.
+ *
+ * @experimental
+ */
+ static final String P_BUILDER_USE_NULL_SCHEDULING_RULE = "builderUsesNullSchedulingRule"; //$NON-NLS-1$
+
}

Back to the top