Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/IMavenConstants.java21
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/ActionMessageProblemInfo.java31
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java21
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/MojoExecutionProblemInfo.java49
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/NotCoveredMojoExecution.java17
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/MavenMarkerResolutionGenerator.java25
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java7
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java7
8 files changed, 118 insertions, 60 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/IMavenConstants.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/IMavenConstants.java
index 47c13ecd..8c417d89 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/IMavenConstants.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/IMavenConstants.java
@@ -11,7 +11,6 @@
package org.eclipse.m2e.core.internal;
-
/**
* Maven Constants
*
@@ -38,19 +37,19 @@ public interface IMavenConstants {
public static final String MARKER_BUILD_ID = MARKER_ID + ".build"; //$NON-NLS-1$
public static final String MARKER_BUILD_PARTICIPANT_ID = MARKER_BUILD_ID + ".participant"; //$NON-NLS-1$
-
+
/**
- * string that gets included in pom.xml file comments and makes the marker manager to ignore
- * the managed version override marker
+ * string that gets included in pom.xml file comments and makes the marker manager to ignore the managed version
+ * override marker
*/
public static final String MARKER_IGNORE_MANAGED = "$NO-MVN-MAN-VER$";//$NON-NLS-1$
public static final String MAVEN_COMPONENT_CONTRIBUTORS_XPT = PLUGIN_ID + ".mavenComponentContributors"; //$NON-NLS-1$
-
+
public static final String POM_FILE_NAME = "pom.xml"; //$NON-NLS-1$
public static final String PREFERENCE_PAGE_ID = PLUGIN_ID + ".MavenProjectPreferencePage"; //$NON-NLS-1$
-
+
public static final String NO_WORKSPACE_PROJECTS = "noworkspace"; //$NON-NLS-1$
public static final String ACTIVE_PROFILES = "profiles"; //$NON-NLS-1$
@@ -69,8 +68,8 @@ public interface IMavenConstants {
public static final String INDEX_UPDATE_PROP = "indexUpdate"; //$NON-NLS-1$
/**
- * marker containing this attribute (with whatever value) will be considered to contain a quick fix
- * and will be marker appropriately in the editor.
+ * marker containing this attribute (with whatever value) will be considered to contain a quick fix and will be marker
+ * appropriately in the editor.
*/
public static final String MARKER_ATTR_EDITOR_HINT = "editor_hint";//$NON-NLS-1$
@@ -99,11 +98,13 @@ public interface IMavenConstants {
public static final String EDITOR_HINT_MANAGED_PLUGIN_OVERRIDE = "managed_plugin_override";//$NON-NLS-1$
public static final String EDITOR_HINT_MISSING_SCHEMA = "missing_schema";//$NON-NLS-1$
-
+
public static final String EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION = "not_covered_mojo_execution";//$NON-NLS-1$
+ public static final String EDITOR_HINT_IMPLICIT_LIFECYCLEMAPPING = "implicit_lifecyclemaping";//$NON-NLS-1$
+
public static final String EDITOR_HINT_UNKNOWN_LIFECYCLE_ID = "unknown_lifecycle_id";//$NON-NLS-1$
-
+
public static final String EDITOR_HINT_MISSING_CONFIGURATOR = "missing_configurator";//$NON-NLS-1$
public static final String MARKER_COLUMN_START = "columnStart"; //$NON-NLS-1$
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/ActionMessageProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/ActionMessageProblemInfo.java
index 2fdacc52..7a853b74 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/ActionMessageProblemInfo.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/ActionMessageProblemInfo.java
@@ -8,23 +8,34 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
+
package org.eclipse.m2e.core.internal.lifecyclemapping;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.markers.SourceLocation;
-import org.eclipse.m2e.core.internal.markers.MavenProblemInfo;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
-public class ActionMessageProblemInfo extends MavenProblemInfo {
- private final MojoExecutionKey mojoExecutionKey;
- public MojoExecutionKey getMojoExecutionKey() {
- return this.mojoExecutionKey;
- }
+public class ActionMessageProblemInfo extends MojoExecutionProblemInfo {
+
+ private final boolean pomMapping;
public ActionMessageProblemInfo(String message, int severity, MojoExecutionKey mojoExecutionKey,
- SourceLocation markerLocation) {
- //TODO Use actual location
- super(message, severity, markerLocation);
- this.mojoExecutionKey = mojoExecutionKey;
+ SourceLocation markerLocation, boolean pomMapping) {
+ super(message, severity, mojoExecutionKey, markerLocation);
+ this.pomMapping = pomMapping;
}
+
+ public void processMarker(IMarker marker) throws CoreException {
+ super.processMarker(marker);
+
+ if(!pomMapping) {
+ marker.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT,
+ IMavenConstants.EDITOR_HINT_IMPLICIT_LIFECYCLEMAPPING);
+ }
+ }
+
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
index a47b3303..50e47c3d 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/LifecycleMappingFactory.java
@@ -156,7 +156,7 @@ public class LifecycleMappingFactory {
private static final String LIFECYCLE_MAPPING_METADATA_CLASSIFIER = "lifecycle-mapping-metadata";
private static List<LifecycleMappingMetadataSource> bundleMetadataSources = null;
-
+
public static LifecycleMappingResult calculateLifecycleMapping(MavenExecutionRequest templateRequest,
MavenProjectFacade projectFacade, IProgressMonitor monitor) {
long start = System.currentTimeMillis();
@@ -495,6 +495,7 @@ public class LifecycleMappingFactory {
List<PluginExecutionMetadata> result = new ArrayList<PluginExecutionMetadata>();
all_metadatas: for(PluginExecutionMetadata metadata : metadatas) {
+ @SuppressWarnings("unchecked")
Map<String, String> parameters = metadata.getFilter().getParameters();
if(!parameters.isEmpty()) {
for(String name : parameters.keySet()) {
@@ -572,14 +573,14 @@ public class LifecycleMappingFactory {
}
SourceLocation markerLocation = SourceLocationHelper.findLocation(mavenProject, executionKey);
result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_ERROR, executionKey,
- markerLocation));
+ markerLocation, isPomMapping(metadata)));
break;
}
case execute:
if(message != null) {
SourceLocation markerLocation = SourceLocationHelper.findLocation(mavenProject, executionKey);
result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_WARNING, executionKey,
- markerLocation));
+ markerLocation, isPomMapping(metadata)));
}
break;
case configurator:
@@ -599,7 +600,7 @@ public class LifecycleMappingFactory {
if(message != null) {
SourceLocation markerLocation = SourceLocationHelper.findLocation(mavenProject, executionKey);
result.addProblem(new ActionMessageProblemInfo(message, IMarker.SEVERITY_WARNING, executionKey,
- markerLocation));
+ markerLocation, isPomMapping(metadata)));
}
break;
default:
@@ -611,6 +612,11 @@ public class LifecycleMappingFactory {
result.setProjectConfigurators(configurators);
}
+ private static boolean isPomMapping(IPluginExecutionMetadata metadata) {
+ LifecycleMappingMetadataSource source = ((PluginExecutionMetadata) metadata).getSource();
+ return source != null && source.getSource() instanceof MavenProject;
+ }
+
/**
* Returns lifecycle mapping metadata sources embedded or referenced by pom.xml in the following order
* <ol>
@@ -736,12 +742,13 @@ public class LifecycleMappingFactory {
MojoExecution mojoExecution, IPluginExecutionMetadata executionMetadata) {
boolean runOnIncremental = true;
boolean runOnConfiguration = false;
- Xpp3Dom child = ((PluginExecutionMetadata) executionMetadata).getConfiguration().getChild(ELEMENT_RUN_ON_INCREMENTAL);
+ Xpp3Dom child = ((PluginExecutionMetadata) executionMetadata).getConfiguration().getChild(
+ ELEMENT_RUN_ON_INCREMENTAL);
if(child != null) {
runOnIncremental = Boolean.parseBoolean(child.getValue());
}
child = ((PluginExecutionMetadata) executionMetadata).getConfiguration().getChild(ELEMENT_RUN_ON_CONFIGURATION);
- if (child != null) {
+ if(child != null) {
runOnConfiguration = Boolean.parseBoolean(child.getValue());
}
return new MojoExecutionBuildParticipant(mojoExecution, runOnIncremental, runOnConfiguration);
@@ -1053,7 +1060,7 @@ public class LifecycleMappingFactory {
public synchronized static List<LifecycleMappingMetadataSource> getBundleMetadataSources() {
if(bundleMetadataSources == null) {
bundleMetadataSources = new ArrayList<LifecycleMappingMetadataSource>();
-
+
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint configuratorsExtensionPoint = registry
.getExtensionPoint(EXTENSION_LIFECYCLE_MAPPING_METADATA_SOURCE);
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/MojoExecutionProblemInfo.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/MojoExecutionProblemInfo.java
new file mode 100644
index 00000000..49101a7a
--- /dev/null
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/MojoExecutionProblemInfo.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.internal.lifecyclemapping;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.internal.markers.MavenProblemInfo;
+import org.eclipse.m2e.core.internal.markers.SourceLocation;
+import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
+
+
+public abstract class MojoExecutionProblemInfo extends MavenProblemInfo {
+ private final MojoExecutionKey mojoExecutionKey;
+
+ protected MojoExecutionProblemInfo(String message, MojoExecutionKey mojoExecutionKey, SourceLocation markerLocation) {
+ super(message, markerLocation);
+ this.mojoExecutionKey = mojoExecutionKey;
+ }
+
+ protected MojoExecutionProblemInfo(String message, int severity, MojoExecutionKey mojoExecutionKey,
+ SourceLocation markerLocation) {
+ super(message, severity, markerLocation);
+ this.mojoExecutionKey = mojoExecutionKey;
+ }
+
+ public void processMarker(IMarker marker) throws CoreException {
+ super.processMarker(marker);
+
+ //TODO what parameters are important here for the hints?
+ 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());
+ }
+
+}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/NotCoveredMojoExecution.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/NotCoveredMojoExecution.java
index 653d4d50..5365b85d 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/NotCoveredMojoExecution.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecyclemapping/NotCoveredMojoExecution.java
@@ -18,31 +18,20 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.Messages;
import org.eclipse.m2e.core.internal.markers.SourceLocation;
-import org.eclipse.m2e.core.internal.markers.MavenProblemInfo;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
-public class NotCoveredMojoExecution extends MavenProblemInfo {
-
- private final MojoExecutionKey mojoExecutionKey;
+public class NotCoveredMojoExecution extends MojoExecutionProblemInfo {
public NotCoveredMojoExecution(MojoExecutionKey mojoExecutionKey, SourceLocation markerLocation) {
super(NLS.bind(Messages.LifecycleConfigurationPluginExecutionNotCovered, mojoExecutionKey.toString()),
- markerLocation);
- this.mojoExecutionKey = mojoExecutionKey;
+ mojoExecutionKey, markerLocation);
}
public void processMarker(IMarker marker) throws CoreException {
super.processMarker(marker);
+
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, 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());
}
}
-
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/MavenMarkerResolutionGenerator.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/MavenMarkerResolutionGenerator.java
index 4d1e3ceb..f14b9c66 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/MavenMarkerResolutionGenerator.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/MavenMarkerResolutionGenerator.java
@@ -39,28 +39,27 @@ public class MavenMarkerResolutionGenerator implements IMarkerResolutionGenerato
return new IMarkerResolution[] {new XMLSchemaMarkerResolution()};
}
if(IMavenConstants.EDITOR_HINT_PARENT_VERSION.equals(hint)) {
- return new IMarkerResolution[] {new PomQuickAssistProcessor.IdPartRemovalProposal(marker, true) };
+ return new IMarkerResolution[] {new PomQuickAssistProcessor.IdPartRemovalProposal(marker, true)};
}
if(IMavenConstants.EDITOR_HINT_PARENT_GROUP_ID.equals(hint)) {
- return new IMarkerResolution[] {new PomQuickAssistProcessor.IdPartRemovalProposal(marker, false) };
+ return new IMarkerResolution[] {new PomQuickAssistProcessor.IdPartRemovalProposal(marker, false)};
}
if(hint.equals(IMavenConstants.EDITOR_HINT_MANAGED_DEPENDENCY_OVERRIDE)) {
- return new IMarkerResolution[] {
- new PomQuickAssistProcessor.ManagedVersionRemovalProposal(marker, true),
- new PomQuickAssistProcessor.IgnoreWarningProposal(marker, IMavenConstants.MARKER_IGNORE_MANAGED)
- };
+ return new IMarkerResolution[] {new PomQuickAssistProcessor.ManagedVersionRemovalProposal(marker, true),
+ new PomQuickAssistProcessor.IgnoreWarningProposal(marker, IMavenConstants.MARKER_IGNORE_MANAGED)};
}
if(hint.equals(IMavenConstants.EDITOR_HINT_MANAGED_PLUGIN_OVERRIDE)) {
- return new IMarkerResolution[] {
- new PomQuickAssistProcessor.ManagedVersionRemovalProposal(marker, false),
- new PomQuickAssistProcessor.IgnoreWarningProposal(marker, IMavenConstants.MARKER_IGNORE_MANAGED)
- };
+ return new IMarkerResolution[] {new PomQuickAssistProcessor.ManagedVersionRemovalProposal(marker, false),
+ new PomQuickAssistProcessor.IgnoreWarningProposal(marker, IMavenConstants.MARKER_IGNORE_MANAGED)};
}
if(hint.equals(IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION)) {
- return new IMarkerResolution[] {
- new LifecycleMappingProposal(marker, PluginExecutionAction.ignore)
+ return new IMarkerResolution[] {new LifecycleMappingProposal(marker, PluginExecutionAction.ignore)
// new LifecycleMappingProposal(marker, PluginExecutionAction.execute)
- };
+ };
+ }
+ if(marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR) == IMarker.SEVERITY_ERROR
+ && hint.equals(IMavenConstants.EDITOR_HINT_IMPLICIT_LIFECYCLEMAPPING)) {
+ return new IMarkerResolution[] {new LifecycleMappingProposal(marker, PluginExecutionAction.ignore)};
}
}
return new IMarkerResolution[0];
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
index 1996de4d..81231f73 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomHyperlinkDetector.java
@@ -469,10 +469,9 @@ public class PomHyperlinkDetector implements IHyperlinkDetector {
int row = marker.getAttribute(IMavenConstants.MARKER_CAUSE_LINE_NUMBER, 0);
int column = marker.getAttribute(IMavenConstants.MARKER_CAUSE_COLUMN_START, 0);
String name = marker.getAttribute(IMavenConstants.MARKER_CAUSE_RESOURCE_ID, null);
- String hint = marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null);
- if (IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION.equals(hint)) {
-
- }
+// String hint = marker.getAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, null);
+// if (IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION.equals(hint)) {
+// }
openXmlEditor(fileStore, row, column, name);
}
}
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
index 5ebf01d3..4ea8e323 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
@@ -117,11 +117,14 @@ public class PomQuickAssistProcessor implements IQuickAssistProcessor {
proposals.add(new IgnoreWarningProposal(context, mark, IMavenConstants.MARKER_IGNORE_MANAGED));
} else if(hint.equals(IMavenConstants.EDITOR_HINT_MISSING_SCHEMA)) {
proposals.add(new SchemaCompletionProposal(context, mark));
- }
- else if (hint.equals(IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION)) {
+ } else if (hint.equals(IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION)) {
extractedFromMarkers(proposals, mark); //having this first sort of helps for 335490
proposals.add(new LifecycleMappingProposal(context, mark, PluginExecutionAction.ignore));
// proposals.add(new LifecycleMappingProposal(context, mark, PluginExecutionAction.execute));
+ } else if(mark.getMarker().getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR) == IMarker.SEVERITY_ERROR
+ && hint.equals(IMavenConstants.EDITOR_HINT_IMPLICIT_LIFECYCLEMAPPING)) {
+ extractedFromMarkers(proposals, mark); //having this first sort of helps for 335490
+ proposals.add(new LifecycleMappingProposal(context, mark, PluginExecutionAction.ignore));
}
}
}

Back to the top