Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladt2011-01-24 17:35:33 +0000
committervladt2011-01-24 17:35:33 +0000
commit925c9b63de180056b3598d0b6de57c6a5ebfbc8e (patch)
tree5944d7a0d8e642ccf3b73d1e758b946a84d85adf
parent21b40e1fe16a47ffc4b83eba46b78469137f6e14 (diff)
downloadm2e-core-925c9b63de180056b3598d0b6de57c6a5ebfbc8e.tar.gz
m2e-core-925c9b63de180056b3598d0b6de57c6a5ebfbc8e.tar.xz
m2e-core-925c9b63de180056b3598d0b6de57c6a5ebfbc8e.zip
MNGECLIPSE-2755: Added optional message to "ignore" and "execute" plugin execution actions and added "error" action
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/InvalidLifecycleMapping.java43
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java12
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java38
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java36
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/model/PluginExecutionAction.java3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties1
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java47
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractCustomizableLifecycleMapping.java42
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java24
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ActionMessageProblemInfo.java24
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/LifecycleMappingProblemInfo.java49
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/MissingConfiguratorProblemInfo.java35
-rw-r--r--org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java5
14 files changed, 248 insertions, 113 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
index 5db12806..6c92b262 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Messages.java
@@ -217,6 +217,8 @@ public class Messages extends NLS {
public static String LifecycleConfigurationMojoExecutionNotCovered;
+ public static String LifecycleConfigurationMojoExecutionErrorMessage;
+
public static String LifecycleMissing;
public static String LifecycleDuplicate;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/InvalidLifecycleMapping.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/InvalidLifecycleMapping.java
index 73748d72..be205ba8 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/InvalidLifecycleMapping.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/InvalidLifecycleMapping.java
@@ -15,15 +15,11 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.apache.maven.plugin.MojoExecution;
-import org.eclipse.m2e.core.core.IMavenConstants;
import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionMetadata;
-import org.eclipse.m2e.core.internal.project.MarkerUtils;
import org.eclipse.m2e.core.project.configurator.AbstractBuildParticipant;
import org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping;
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
@@ -38,45 +34,6 @@ import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
*/
public class InvalidLifecycleMapping extends AbstractLifecycleMapping {
- public static class MissingLifecycleExtensionPoint extends LifecycleMappingProblemInfo {
- private final String lifecycleId;
-
- MissingLifecycleExtensionPoint(int line, String message, String lifecycleId) {
- super(line, message);
- this.lifecycleId = lifecycleId;
- }
-
- public String getLifecycleId() {
- return lifecycleId;
- }
-
- @Override
- public void processMarker(IMarker marker) throws CoreException {
- MarkerUtils.decorateMarker(marker);
- marker.setAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, getLifecycleId());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_UNKNOWN_LIFECYCLE_ID);
- }
- }
-
- public static class MissingLifecyclePackaging extends LifecycleMappingProblemInfo {
- private final String packaging;
-
- MissingLifecyclePackaging(int line, String message, String packaging) {
- super(line, message);
- this.packaging = packaging;
- }
-
- public String getPackaging() {
- return packaging;
- }
-
- @Override
- public void processMarker(IMarker marker) throws CoreException {
- marker.setAttribute(IMavenConstants.MARKER_ATTR_PACKAGING, getPackaging());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_UNKNOWN_PACKAGING);
- }
- }
-
public String getId() {
return "invalid";
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
index 2b82c738..2951759d 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java
@@ -125,6 +125,8 @@ public class LifecycleMappingFactory {
private static final String ELEMENT_CONFIGURATOR = "configurator"; //$NON-NLS-1$
+ private static final String ELEMENT_MESSAGE = "message"; //$NON-NLS-1$
+
private static final String ELEMENT_RUN_ON_INCREMENTAL = "runOnIncremental";
private static final String ATTR_GROUPID = "groupId";
@@ -367,13 +369,21 @@ public class LifecycleMappingFactory {
return child.getValue();
}
+ public static String getActionMessage(PluginExecutionMetadata pluginExecutionMetadata) {
+ Xpp3Dom child = pluginExecutionMetadata.getConfiguration().getChild(ELEMENT_MESSAGE);
+ if(child == null || child.getValue().trim().length() == 0) {
+ return null;
+ }
+ return child.getValue();
+ }
+
public static LifecycleMappingMetadataSource createLifecycleMappingMetadataSource(URL url) {
try {
return new LifecycleMappingMetadataSourceXpp3Reader().read(url.openStream());
} catch(XmlPullParserException e) {
throw new LifecycleMappingConfigurationException("Cannot parse lifecycle mapping metadata", e);
} catch(IOException e) {
- throw new LifecycleMappingConfigurationException("Cannot parse lifecycle mapping metadata", e);
+ throw new LifecycleMappingConfigurationException("Cannot read lifecycle mapping metadata", e);
}
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java
new file mode 100644
index 00000000..ade92047
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecycleExtensionPoint.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.internal.lifecycle;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.m2e.core.core.IMavenConstants;
+import org.eclipse.m2e.core.internal.project.MarkerUtils;
+import org.eclipse.m2e.core.project.configurator.LifecycleMappingProblemInfo;
+
+public class MissingLifecycleExtensionPoint extends LifecycleMappingProblemInfo {
+ private final String lifecycleId;
+
+ MissingLifecycleExtensionPoint(int line, String message, String lifecycleId) {
+ super(line, message);
+ this.lifecycleId = lifecycleId;
+ }
+
+ public String getLifecycleId() {
+ return lifecycleId;
+ }
+
+ @Override
+ public void processMarker(IMarker marker) throws CoreException {
+ MarkerUtils.decorateMarker(marker);
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, getLifecycleId());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_UNKNOWN_LIFECYCLE_ID);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java
new file mode 100644
index 00000000..81e7cadf
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/MissingLifecyclePackaging.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.internal.lifecycle;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.m2e.core.core.IMavenConstants;
+import org.eclipse.m2e.core.project.configurator.LifecycleMappingProblemInfo;
+
+public class MissingLifecyclePackaging extends LifecycleMappingProblemInfo {
+ private final String packaging;
+
+ MissingLifecyclePackaging(int line, String message, String packaging) {
+ super(line, message);
+ this.packaging = packaging;
+ }
+
+ public String getPackaging() {
+ return packaging;
+ }
+
+ @Override
+ public void processMarker(IMarker marker) throws CoreException {
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_PACKAGING, getPackaging());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_UNKNOWN_PACKAGING);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/model/PluginExecutionAction.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/model/PluginExecutionAction.java
index df181d14..4bc0a490 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/model/PluginExecutionAction.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/model/PluginExecutionAction.java
@@ -13,5 +13,6 @@ package org.eclipse.m2e.core.internal.lifecycle.model;
public enum PluginExecutionAction {
ignore, //
execute, //
- configurator;
+ configurator, //
+ error;
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
index 476280b6..cbfc7a0c 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/messages.properties
@@ -96,6 +96,7 @@ GlobalRepositoriesNode_name=Global Repositories
IndexedArtifactNode_no_pack=[No Packaging]
IndexUpdaterJob_title=Updating indexes
LifecycleConfigurationMojoExecutionNotCovered=Mojo execution not covered by lifecycle configuration: {0} (maven lifecycle phase: {1})
+LifecycleConfigurationMojoExecutionErrorMessage=Mojo execution marked as error in lifecycle configuration: {0} (maven lifecycle phase: {1})
LifecycleMissing=Unknown or missing lifecycle mapping (project packaging type="{0}")
LifecycleDuplicate=Conflicting lifecycle mapping metadata (project packaging type="{0}"). To enable full functionality, remove the conflicting mapping and run Maven->Update Project Configuration.
LifecycleMappingNotAvailable=Lifecycle mapping "{0}" is not available. To enable full functionality, install the lifecycle mapping and run Maven->Update Project Configuration.
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java
index 0c1b4c0d..988d7686 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java
@@ -89,6 +89,7 @@ import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping;
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
import org.eclipse.m2e.core.project.configurator.ILifecycleMapping;
+import org.eclipse.m2e.core.project.configurator.LifecycleMappingProblemInfo;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
import org.eclipse.m2e.core.util.Util;
@@ -328,16 +329,19 @@ public class ProjectConfigurationManager implements IProjectConfigurationManager
}
public boolean validateProjectConfiguration(IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor) {
+ boolean isValid = true;
try {
- ((MavenProjectFacade) mavenProjectFacade).setHasValidConfiguration(false);
mavenMarkerManager.deleteMarkers(mavenProjectFacade.getPom(), IMavenConstants.MARKER_CONFIGURATION_ID);
ILifecycleMapping lifecycleMapping = getLifecycleMapping(mavenProjectFacade, monitor);
if(lifecycleMapping instanceof AbstractLifecycleMapping) {
- for (AbstractLifecycleMapping.LifecycleMappingProblemInfo problem : ((AbstractLifecycleMapping)lifecycleMapping).getProblems()) {
- IMarker marker = mavenMarkerManager.addMarker(mavenProjectFacade.getPom(), IMavenConstants.MARKER_CONFIGURATION_ID,
- problem.getMessage(), problem.getLine(), IMarker.SEVERITY_ERROR);
+ for(LifecycleMappingProblemInfo problem : ((AbstractLifecycleMapping) lifecycleMapping).getProblems()) {
+ if(problem.getSeverity() == IMarker.SEVERITY_ERROR) {
+ isValid = false;
+ }
+ IMarker marker = mavenMarkerManager.addMarker(mavenProjectFacade.getPom(),
+ IMavenConstants.MARKER_CONFIGURATION_ID, problem.getMessage(), problem.getLine(), problem.getSeverity());
problem.processMarker(marker);
}
}
@@ -352,37 +356,38 @@ public class ProjectConfigurationManager implements IProjectConfigurationManager
marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_UNKNOWN_PACKAGING);
MarkerUtils.decorateMarker(marker);
+ isValid = false;
return false;
}
List<MojoExecutionKey> notCoveredMojoExecutions = lifecycleMapping.getNotCoveredMojoExecutions(monitor);
if(notCoveredMojoExecutions != null && notCoveredMojoExecutions.size() != 0) {
- for(MojoExecutionKey mojoExecution : notCoveredMojoExecutions) {
- IMarker marker = mavenMarkerManager.addMarker(
- mavenProjectFacade.getPom(),
- IMavenConstants.MARKER_CONFIGURATION_ID,
- NLS.bind(Messages.LifecycleConfigurationMojoExecutionNotCovered, mojoExecution.toString(),
- mojoExecution.getLifecyclePhase()), 1 /*lineNumber*/, IMarker.SEVERITY_ERROR);
-
+ for(MojoExecutionKey mojoExecutionKey : notCoveredMojoExecutions) {
+ IMarker marker = mavenMarkerManager.addMarker(mavenProjectFacade.getPom(),
+ IMavenConstants.MARKER_CONFIGURATION_ID, NLS.bind(Messages.LifecycleConfigurationMojoExecutionNotCovered,
+ mojoExecutionKey.toString(), mojoExecutionKey.getLifecyclePhase()), 1 /*lineNumber*/,
+ IMarker.SEVERITY_ERROR);
+
marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT,
IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION);
//TODO what parameters are important here for the hints?
- marker.setAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, mojoExecution.getGroupId());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, mojoExecution.getArtifactId());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_EXECUTION_ID, mojoExecution.getExecutionId());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_GOAL, mojoExecution.getGoal());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_VERSION, mojoExecution.getVersion());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, mojoExecution.getLifecyclePhase());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, mojoExecutionKey.getGroupId());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, mojoExecutionKey.getArtifactId());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_EXECUTION_ID, mojoExecutionKey.getExecutionId());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_GOAL, mojoExecutionKey.getGoal());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_VERSION, mojoExecutionKey.getVersion());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_LIFECYCLE_PHASE, mojoExecutionKey.getLifecyclePhase());
MarkerUtils.decorateMarker(marker);
}
- return false;
+ isValid = false;
}
- ((MavenProjectFacade) mavenProjectFacade).setHasValidConfiguration(true);
- return true;
} catch(CoreException e) {
mavenMarkerManager.addErrorMarkers(mavenProjectFacade.getPom(), IMavenConstants.MARKER_CONFIGURATION_ID, e);
- return false;
+ isValid = false;
+ } finally {
+ ((MavenProjectFacade) mavenProjectFacade).setHasValidConfiguration(isValid);
}
+ return isValid;
}
public void enableMavenNature(IProject project, ResolverConfiguration configuration, IProgressMonitor monitor)
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractCustomizableLifecycleMapping.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractCustomizableLifecycleMapping.java
index 167e8799..5809c014 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractCustomizableLifecycleMapping.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractCustomizableLifecycleMapping.java
@@ -17,13 +17,11 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.apache.maven.plugin.MojoExecution;
-import org.eclipse.m2e.core.core.IMavenConstants;
import org.eclipse.m2e.core.internal.Messages;
import org.eclipse.m2e.core.internal.lifecycle.LifecycleMappingFactory;
import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionAction;
@@ -37,25 +35,6 @@ import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionMetadata;
*/
public abstract class AbstractCustomizableLifecycleMapping extends AbstractLifecycleMapping {
- public static class MissingConfiguratorProblemInfo extends LifecycleMappingProblemInfo {
- private final String configuratorId;
-
- public MissingConfiguratorProblemInfo(int line, String message, String configuratorId) {
- super(line, message);
- this.configuratorId = configuratorId;
- }
-
- public String getConfiguratorId() {
- return configuratorId;
- }
-
- @Override
- public void processMarker(IMarker marker) throws CoreException {
- marker.setAttribute(IMavenConstants.MARKER_ATTR_CONFIGURATOR_ID, getConfiguratorId());
- marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_MISSING_CONFIGURATOR);
- }
- }
-
private Map<MojoExecutionKey, List<PluginExecutionMetadata>> effectiveMapping;
private Map<String, AbstractProjectConfigurator> configurators;
@@ -103,17 +82,31 @@ public abstract class AbstractCustomizableLifecycleMapping extends AbstractLifec
switch(executionMetadata.getAction()) {
case ignore:
case execute:
+ String message = LifecycleMappingFactory.getActionMessage(executionMetadata);
+ if(message != null) {
+ addProblem(new ActionMessageProblemInfo(executionKey, 1 /*line*/, message, IMarker.SEVERITY_WARNING));
+ }
+ continue all_mojo_executions;
+ case error:
+ message = LifecycleMappingFactory.getActionMessage(executionMetadata);
+ if(message == null) {
+ message = NLS.bind(Messages.LifecycleConfigurationMojoExecutionErrorMessage, executionKey.toString(),
+ executionKey.getLifecyclePhase());
+ }
+ addProblem(new ActionMessageProblemInfo(executionKey, 1 /*line*/, message, IMarker.SEVERITY_ERROR));
continue all_mojo_executions;
case configurator:
if(configurators.containsKey(LifecycleMappingFactory.getProjectConfiguratorId(executionMetadata))) {
continue all_mojo_executions;
}
+ break;
+ default:
+ throw new IllegalArgumentException("Missing handling for action=" + executionMetadata.getAction());
}
}
}
notCoveredExecutions.add(executionKey);
}
-
}
public Map<MojoExecutionKey, List<AbstractBuildParticipant>> getBuildParticipants(IProgressMonitor monitor) {
@@ -139,7 +132,10 @@ public abstract class AbstractCustomizableLifecycleMapping extends AbstractLifec
}
break;
case ignore:
+ case error:
break;
+ default:
+ throw new IllegalArgumentException("Missing handling for action=" + executionMetadata.getAction());
}
}
}
@@ -159,6 +155,6 @@ public abstract class AbstractCustomizableLifecycleMapping extends AbstractLifec
}
public void addMissingConfiguratorProblem(int line, String message, String configuratorId) {
- super.addProblem(new MissingConfiguratorProblemInfo(line, message, configuratorId));
+ addProblem(new MissingConfiguratorProblemInfo(line, message, configuratorId));
}
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
index 90a5c9cc..21ef652e 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractLifecycleMapping.java
@@ -16,7 +16,6 @@ import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
@@ -37,29 +36,6 @@ import org.eclipse.m2e.core.project.IMavenProjectFacade;
*/
public abstract class AbstractLifecycleMapping implements ILifecycleMapping {
- public static class LifecycleMappingProblemInfo {
- private final int line;
-
- private final String message;
-
- protected LifecycleMappingProblemInfo(int line, String message) {
- this.line = line;
- this.message = message;
- }
-
- public int getLine() {
- return line;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void processMarker(IMarker marker) throws CoreException {
-
- }
- }
-
private String name;
private String id;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ActionMessageProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ActionMessageProblemInfo.java
new file mode 100644
index 00000000..ac38d0dc
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ActionMessageProblemInfo.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.project.configurator;
+
+public class ActionMessageProblemInfo extends LifecycleMappingProblemInfo {
+ private final MojoExecutionKey mojoExecutionKey;
+
+ public MojoExecutionKey getMojoExecutionKey() {
+ return this.mojoExecutionKey;
+ }
+
+ protected ActionMessageProblemInfo(MojoExecutionKey mojoExecutionKey, int line, String message, int severity) {
+ super(line, message, severity);
+ this.mojoExecutionKey = mojoExecutionKey;
+ }
+}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/LifecycleMappingProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/LifecycleMappingProblemInfo.java
new file mode 100644
index 00000000..10dd9882
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/LifecycleMappingProblemInfo.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.project.configurator;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+public class LifecycleMappingProblemInfo {
+ private final int line;
+
+ private final String message;
+
+ private final int severity;
+
+ protected LifecycleMappingProblemInfo(int line, String message) {
+ this.line = line;
+ this.message = message;
+ this.severity = IMarker.SEVERITY_ERROR;
+ }
+
+ protected LifecycleMappingProblemInfo(int line, String message, int severity) {
+ this.line = line;
+ this.message = message;
+ this.severity = severity;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public int getSeverity() {
+ return this.severity;
+ }
+
+ public void processMarker(IMarker marker) throws CoreException {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/MissingConfiguratorProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/MissingConfiguratorProblemInfo.java
new file mode 100644
index 00000000..ba747a4c
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/MissingConfiguratorProblemInfo.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.m2e.core.project.configurator;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.m2e.core.core.IMavenConstants;
+
+public class MissingConfiguratorProblemInfo extends LifecycleMappingProblemInfo {
+ private final String configuratorId;
+
+ public MissingConfiguratorProblemInfo(int line, String message, String configuratorId) {
+ super(line, message);
+ this.configuratorId = configuratorId;
+ }
+
+ public String getConfiguratorId() {
+ return configuratorId;
+ }
+
+ @Override
+ public void processMarker(IMarker marker) throws CoreException {
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_CONFIGURATOR_ID, getConfiguratorId());
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_MISSING_CONFIGURATOR);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
index 61acb416..414dd690 100644
--- a/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
+++ b/org.eclipse.m2e.tests.common/src/org/eclipse/m2e/tests/common/WorkspaceHelpers.java
@@ -183,6 +183,11 @@ public class WorkspaceHelpers {
Assert.assertEquals("Unexpected error markers " + toString(markers), 0, markers.size());
}
+ public static void assertNoWarnings(IProject project) throws CoreException {
+ List<IMarker> markers = findWarningMarkers(project);
+ Assert.assertEquals("Unexpected warning markers " + toString(markers), 0, markers.size());
+ }
+
public static IMarker assertErrorMarker(String type, String message, Integer lineNumber, IProject project)
throws Exception {
return assertErrorMarker(type, message, lineNumber, project, "pom.xml");

Back to the top