Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladt2010-12-23 16:51:01 -0500
committervladt2010-12-23 16:51:34 -0500
commit6fe5fd2d7ef81b4a9a5561751133a2a12838982f (patch)
tree59ae529754e4c5869b1554c64348e15cb1c257ed
parent1298722765397083784ef374c1cf333fd6d22c7a (diff)
downloadm2e-core-6fe5fd2d7ef81b4a9a5561751133a2a12838982f.tar.gz
m2e-core-6fe5fd2d7ef81b4a9a5561751133a2a12838982f.tar.xz
m2e-core-6fe5fd2d7ef81b4a9a5561751133a2a12838982f.zip
MNGECLIPSE-2681: Use modello model in lifecycle mapping eclipse extensions
-rw-r--r--org.eclipse.m2e.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.m2e.core/schema/lifecycleMappings.exsd88
-rw-r--r--org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml67
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java85
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/IgnoreMojoProjectConfiguration.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/MojoExecutionProjectConfigurator.java2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java1
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionFilter.java85
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionMetadata.java2
-rw-r--r--org.eclipse.m2e.jdt/plugin.xml50
10 files changed, 204 insertions, 179 deletions
diff --git a/org.eclipse.m2e.core/META-INF/MANIFEST.MF b/org.eclipse.m2e.core/META-INF/MANIFEST.MF
index 7d5ddaaf..86e42eb5 100644
--- a/org.eclipse.m2e.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.m2e.core/META-INF/MANIFEST.MF
@@ -38,6 +38,7 @@ Export-Package: org.eclipse.m2e.core,
org.eclipse.m2e.core.internal.embedder;x-friends:="org.eclipse.m2e.core.tests",
org.eclipse.m2e.core.internal.index;x-friends:="org.eclipse.m2e.core.tests",
org.eclipse.m2e.core.internal.lifecycle;x-friends:="org.eclipse.m2e.tests",
+ org.eclipse.m2e.core.internal.lifecycle.model;x-friends:="org.eclipse.m2e.tests",
org.eclipse.m2e.core.internal.preferences;x-friends:="org.eclipse.m2e.core.tests",
org.eclipse.m2e.core.internal.project;x-friends:="org.eclipse.m2e.core.tests",
org.eclipse.m2e.core.internal.project.registry;x-friends:="org.eclipse.m2e.core.tests",
diff --git a/org.eclipse.m2e.core/schema/lifecycleMappings.exsd b/org.eclipse.m2e.core/schema/lifecycleMappings.exsd
index 8b880ad6..0670157f 100644
--- a/org.eclipse.m2e.core/schema/lifecycleMappings.exsd
+++ b/org.eclipse.m2e.core/schema/lifecycleMappings.exsd
@@ -50,7 +50,7 @@
<element name="lifecycleMapping">
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
- <element ref="mojo"/>
+ <element ref="pluginExecution"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
@@ -88,42 +88,57 @@
</attribute>
</complexType>
</element>
+
+ <element name="id" type="string">
+ </element>
+
+ <element name="groupId" type="string">
+ </element>
+
+ <element name="artifactId" type="string">
+ </element>
+
+ <element name="versionRange" type="string">
+ </element>
+
+ <element name="goal" type="string">
+ </element>
+
+ <element name="goals">
+ <complexType>
+ <sequence>
+ <element ref="goal" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
- <element name="mojo">
+ <element name="action">
<complexType>
<choice>
<element ref="configurator"/>
<element ref="execute"/>
<element ref="ignore"/>
</choice>
- <attribute name="groupId" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="artifactId" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="versionRange" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="goals" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
+ </complexType>
+ </element>
+
+ <element name="filter">
+ <complexType>
+ <all>
+ <element ref="groupId" minOccurs="1" maxOccurs="1"/>
+ <element ref="artifactId" minOccurs="1" maxOccurs="1"/>
+ <element ref="versionRange" minOccurs="1" maxOccurs="1"/>
+ <element ref="goals" minOccurs="1" maxOccurs="1"/>
+ </all>
+ </complexType>
+ </element>
+
+ <element name="pluginExecution">
+ <complexType>
+ <all>
+ <element ref="filter" minOccurs="1" maxOccurs="1"/>
+ <element ref="action" minOccurs="1" maxOccurs="1"/>
+ </all>
</complexType>
</element>
@@ -135,16 +150,9 @@
<element name="configurator">
<complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.m2e.core.projectConfigurators/configurator/@id"/>
- </appinfo>
- </annotation>
- </attribute>
+ <all>
+ <element ref="id" minOccurs="1" maxOccurs="1"/>
+ </all>
</complexType>
</element>
diff --git a/org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml b/org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml
index f623e63b..7bafd262 100644
--- a/org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml
+++ b/org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml
@@ -64,8 +64,8 @@
</fields>
</class>
- <class xml.tagName="pluginExecution" xml.standaloneRead="true">
- <name>PluginExecutionData</name>
+ <class xml.tagName="filter">
+ <name>PluginExecutionFilter</name>
<fields>
<field required="true">
<name>groupId</name>
@@ -75,7 +75,7 @@
<name>artifactId</name>
<type>String</type>
</field>
- <field required="true">
+ <field required="true" java.setter="false">
<name>versionRange</name>
<type>String</type>
</field>
@@ -87,6 +87,67 @@
<multiplicity>*</multiplicity>
</association>
</field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <code><![CDATA[
+ public PluginExecutionFilter() {
+ }
+
+ public PluginExecutionFilter(String groupId, String artifactId, String versionRange, java.util.Set<String> goals) {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ setVersionRange(versionRange);
+ this.goals = goals;
+ }
+
+ public PluginExecutionFilter(String groupId, String artifactId, String versionRange, String goals) {
+ this(groupId, artifactId, versionRange, new java.util.LinkedHashSet<String>(java.util.Arrays.asList(goals.split(",")))); //$NON-NLS-1$;
+ }
+
+ private org.apache.maven.artifact.versioning.VersionRange parsedVersionRange;
+
+ public void setVersionRange(String versionRange) {
+ try {
+ this.versionRange = versionRange;
+ parsedVersionRange = org.apache.maven.artifact.versioning.VersionRange.createFromVersionSpec(versionRange);
+ } catch(org.apache.maven.artifact.versioning.InvalidVersionSpecificationException e) {
+ throw new IllegalArgumentException("Cannot parse version range: " + versionRange, e);
+ }
+ }
+
+ /**
+ * @return true if mojoExecution matches this key or false otherwise
+ */
+ public boolean match(org.apache.maven.plugin.MojoExecution mojoExecution) {
+ if(!getGroupId().equals(mojoExecution.getGroupId()) || !getArtifactId().equals(mojoExecution.getArtifactId())) {
+ return false;
+ }
+
+ org.apache.maven.artifact.versioning.DefaultArtifactVersion version = new org.apache.maven.artifact.versioning.DefaultArtifactVersion(mojoExecution.getVersion());
+
+ if(!parsedVersionRange.containsVersion(version)) {
+ return false;
+ }
+
+ return getGoals().contains(mojoExecution.getGoal());
+ }
+ ]]>
+ </code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+
+ <class xml.tagName="pluginExecution" xml.standaloneRead="true">
+ <name>PluginExecutionData</name>
+ <fields>
+ <field required="true">
+ <name>filter</name>
+ <association>
+ <type>PluginExecutionFilter</type>
+ <multiplicity>1</multiplicity>
+ </association>
+ </field>
<field required="true">
<name>action</name>
<type>DOM</type>
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 6e5db911..b42d3ce1 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
@@ -15,6 +15,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -45,6 +46,7 @@ import org.eclipse.m2e.core.embedder.IMaven;
import org.eclipse.m2e.core.internal.lifecycle.model.LifecycleMappingData;
import org.eclipse.m2e.core.internal.lifecycle.model.LifecycleMappingMetadataData;
import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionData;
+import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionFilter;
import org.eclipse.m2e.core.internal.lifecycle.model.io.xpp3.LifecycleMappingMetadataDataXpp3Reader;
import org.eclipse.m2e.core.internal.project.IgnoreMojoProjectConfiguration;
import org.eclipse.m2e.core.internal.project.MojoExecutionProjectConfigurator;
@@ -55,7 +57,6 @@ import org.eclipse.m2e.core.project.configurator.ILifecycleMapping;
import org.eclipse.m2e.core.project.configurator.LifecycleMappingConfigurationException;
import org.eclipse.m2e.core.project.configurator.LifecycleMappingMetadata;
import org.eclipse.m2e.core.project.configurator.PluginExecutionAction;
-import org.eclipse.m2e.core.project.configurator.PluginExecutionFilter;
import org.eclipse.m2e.core.project.configurator.PluginExecutionMetadata;
@@ -80,11 +81,9 @@ public class LifecycleMappingFactory {
private static final String ELEMENT_CONFIGURATOR = "configurator"; //$NON-NLS-1$
- private static final String ELEMENT_MOJO = "mojo"; //$NON-NLS-1$
-
- private static final String ELEMENT_IGNORE = "ignore"; //$NON-NLS-1$
+ private static final String ELEMENT_PLUGIN_EXECUTION = "pluginExecution"; //$NON-NLS-1$
- private static final String ELEMENT_EXECUTE = "execute";
+ private static final String ELEMENT_MOJO = "mojo"; //$NON-NLS-1$
private static final String ELEMENT_RUN_ON_INCREMENTAL = "runOnIncremental";
@@ -157,31 +156,29 @@ public class LifecycleMappingFactory {
}
protected static ILifecycleMapping createLifecycleMapping(IConfigurationElement element) {
+ String mappingId = null;
try {
ILifecycleMapping mapping = (ILifecycleMapping) element.createExecutableExtension(ATTR_CLASS);
+ mappingId = mapping.getId();
if(mapping instanceof CustomizableLifecycleMapping) {
CustomizableLifecycleMapping customizable = (CustomizableLifecycleMapping) mapping;
- for(IConfigurationElement mojo : element.getChildren(ELEMENT_MOJO)) {
- AbstractProjectConfigurator configurator = null;
- if(mojo.getChildren(ELEMENT_IGNORE).length > 0) {
- configurator = new IgnoreMojoProjectConfiguration(createPluginExecutionFilter(mojo));
- } else if(mojo.getChildren(ELEMENT_EXECUTE).length > 0) {
- configurator = createMojoExecution(mojo.getChildren(ELEMENT_EXECUTE)[0]);
- } else if(mojo.getChildren(ELEMENT_CONFIGURATOR).length > 0) {
- String configuratorId = mojo.getChildren(ELEMENT_CONFIGURATOR)[0].getAttribute(ATTR_ID);
- configurator = createProjectConfigurator(configuratorId, true/*bare*/);
- } else {
- MavenLogger.log("Invalid lifecycle mapping configuration element: " + mojo.toString());
- }
- if(configurator != null) {
- configurator.addPluginExecutionFilter(createPluginExecutionFilter(mojo));
- customizable.addConfigurator(configurator);
- }
+ for(IConfigurationElement pluginExecution : element.getChildren(ELEMENT_PLUGIN_EXECUTION)) {
+ String pluginExecutionXml = toXml(pluginExecution);
+ PluginExecutionData pluginExecutionData = new LifecycleMappingMetadataDataXpp3Reader()
+ .readPluginExecutionData(new StringReader(pluginExecutionXml));
+ PluginExecutionMetadata pluginExecutionMetadata = createPluginExecutionMetadata(pluginExecutionData);
+ AbstractProjectConfigurator configurator = createProjectConfigurator(pluginExecutionMetadata);
+ configurator.addPluginExecutionFilter(pluginExecutionMetadata.getFilter());
+ customizable.addConfigurator(configurator);
}
}
return mapping;
} catch(CoreException ex) {
MavenLogger.log(ex);
+ } catch(IOException e) {
+ throw new LifecycleMappingConfigurationException("Cannot read lifecycle mapping metadata for " + mappingId, e);
+ } catch(XmlPullParserException e) {
+ throw new LifecycleMappingConfigurationException("Cannot parse lifecycle mapping metadata for " + mappingId, e);
}
return null;
}
@@ -195,11 +192,6 @@ public class LifecycleMappingFactory {
return new MojoExecutionProjectConfigurator(pluginExecutionMetadata.getFilter(), runOnIncremental);
}
- private static AbstractProjectConfigurator createMojoExecution(IConfigurationElement configuration) {
- boolean runOnIncremental = true; // TODO
- return new MojoExecutionProjectConfigurator(runOnIncremental);
- }
-
private static PluginExecutionFilter createPluginExecutionFilter(IConfigurationElement configuration) {
String groupId = configuration.getAttribute(ATTR_GROUPID);
String artifactId = configuration.getAttribute(ATTR_ARTIFACTID);
@@ -411,6 +403,12 @@ public class LifecycleMappingFactory {
}
}
+ private static PluginExecutionMetadata createPluginExecutionMetadata(PluginExecutionData pluginExecutionData) {
+ Xpp3Dom actionDom = ((Xpp3Dom) pluginExecutionData.getAction()).getChild(0);
+ PluginExecutionAction action = PluginExecutionAction.valueOf(actionDom.getName().toUpperCase());
+ return new PluginExecutionMetadata(pluginExecutionData.getFilter(), action, actionDom);
+ }
+
private static LifecycleMappingMetadata createLifecycleMappingMetadata(String groupId, String artifactId,
String version, File configuration) throws IOException, XmlPullParserException {
InputStream in = new FileInputStream(configuration);
@@ -424,11 +422,7 @@ public class LifecycleMappingFactory {
}
for(PluginExecutionData pluginExecutionData : lifecycleMappingMetadataData.getPluginExecutions()) {
- PluginExecutionFilter filter = new PluginExecutionFilter(pluginExecutionData.getGroupId(),
- pluginExecutionData.getArtifactId(), pluginExecutionData.getVersionRange(), pluginExecutionData.getGoals());
- Xpp3Dom actionDom = ((Xpp3Dom) pluginExecutionData.getAction()).getChild(0);
- PluginExecutionAction action = PluginExecutionAction.valueOf(actionDom.getName().toUpperCase());
- PluginExecutionMetadata pluginExecutionMetadata = new PluginExecutionMetadata(filter, action, actionDom);
+ PluginExecutionMetadata pluginExecutionMetadata = createPluginExecutionMetadata(pluginExecutionData);
metadata.addPluginExecution(pluginExecutionMetadata);
}
@@ -437,4 +431,33 @@ public class LifecycleMappingFactory {
IOUtil.close(in);
}
}
+
+ private static void toXml(IConfigurationElement configurationElement, StringBuilder output) {
+ output.append('<').append(configurationElement.getName());
+ for(String attrName : configurationElement.getAttributeNames()) {
+ String attrValue = configurationElement.getAttribute(attrName);
+ if(attrValue != null) {
+ output.append(' ').append(attrName).append("=\"").append(attrValue).append('"');
+ }
+ }
+ output.append('>');
+ String configurationElementValue = configurationElement.getValue();
+ if(configurationElementValue != null) {
+ output.append(configurationElementValue);
+ }
+ for(IConfigurationElement childElement : configurationElement.getChildren()) {
+ toXml(childElement, output);
+ }
+ output.append("</").append(configurationElement.getName()).append('>');
+ }
+
+ private static String toXml(IConfigurationElement configurationElement) {
+ if (configurationElement == null) {
+ return null;
+ }
+
+ StringBuilder output = new StringBuilder();
+ toXml(configurationElement, output);
+ return output.toString();
+ }
}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/IgnoreMojoProjectConfiguration.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/IgnoreMojoProjectConfiguration.java
index 558966e3..c586b519 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/IgnoreMojoProjectConfiguration.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/IgnoreMojoProjectConfiguration.java
@@ -13,8 +13,8 @@ package org.eclipse.m2e.core.internal.project;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionFilter;
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
-import org.eclipse.m2e.core.project.configurator.PluginExecutionFilter;
import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/MojoExecutionProjectConfigurator.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/MojoExecutionProjectConfigurator.java
index 174e2a66..dca8aeb9 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/MojoExecutionProjectConfigurator.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/MojoExecutionProjectConfigurator.java
@@ -15,10 +15,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.apache.maven.plugin.MojoExecution;
+import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionFilter;
import org.eclipse.m2e.core.project.configurator.AbstractBuildParticipant;
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
import org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant;
-import org.eclipse.m2e.core.project.configurator.PluginExecutionFilter;
import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java
index d6d51c76..e6a4c14b 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/AbstractProjectConfigurator.java
@@ -34,6 +34,7 @@ import org.eclipse.m2e.core.core.MavenLogger;
import org.eclipse.m2e.core.embedder.IMaven;
import org.eclipse.m2e.core.embedder.IMavenConfiguration;
import org.eclipse.m2e.core.internal.Messages;
+import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionFilter;
import org.eclipse.m2e.core.project.IMavenMarkerManager;
import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionFilter.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionFilter.java
deleted file mode 100644
index 3f2207d9..00000000
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionFilter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008-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 java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.plugin.MojoExecution;
-
-
-public final class PluginExecutionFilter {
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String versionRange;
-
- private final Set<String> goals;
-
- private final VersionRange parsedVersionRange;
-
- public PluginExecutionFilter(String groupId, String artifactId, String versionRange, String goals) {
- this(groupId, artifactId, versionRange, new LinkedHashSet<String>(Arrays.asList(goals.split(",")))); //$NON-NLS-1$;
- }
-
- public PluginExecutionFilter(String groupId, String artifactId, String versionRange, Set<String> goals) {
- this.groupId = groupId;
- this.artifactId = artifactId;
- this.versionRange = versionRange;
- this.goals = goals;
- try {
- this.parsedVersionRange = VersionRange.createFromVersionSpec(versionRange);
- } catch(InvalidVersionSpecificationException e) {
- throw new IllegalArgumentException("Can't parse version range", e);
- }
- }
-
- public String getVersionRange() {
- return this.versionRange;
- }
-
- public String getGroupId() {
- return this.groupId;
- }
-
- public String getArtifactId() {
- return this.artifactId;
- }
-
- public Set<String> getGoals() {
- return this.goals;
- }
-
- /**
- * @return true if mojoExecution matches this key or false otherwise
- */
- public boolean match(MojoExecution mojoExecution) {
- if(!groupId.equals(mojoExecution.getGroupId()) || !artifactId.equals(mojoExecution.getArtifactId())) {
- return false;
- }
-
- DefaultArtifactVersion version = new DefaultArtifactVersion(mojoExecution.getVersion());
-
- if(!parsedVersionRange.containsVersion(version)) {
- return false;
- }
-
- return goals.contains(mojoExecution.getGoal());
- }
-
-}
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionMetadata.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionMetadata.java
index d9e35408..d5ac87c3 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionMetadata.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/PluginExecutionMetadata.java
@@ -12,6 +12,8 @@ package org.eclipse.m2e.core.project.configurator;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.m2e.core.internal.lifecycle.model.PluginExecutionFilter;
+
/**
* PluginExecutionMetadata
*
diff --git a/org.eclipse.m2e.jdt/plugin.xml b/org.eclipse.m2e.jdt/plugin.xml
index a4ef7849..8319de3f 100644
--- a/org.eclipse.m2e.jdt/plugin.xml
+++ b/org.eclipse.m2e.jdt/plugin.xml
@@ -15,24 +15,38 @@
id="org.eclipse.m2e.jdt.JarLifecycleMapping"
name="%lifecycleMapping.jar.name"
packaging-type="jar">
- <mojo
- artifactId="maven-compiler-plugin"
- goals="compile,testCompile"
- groupId="org.apache.maven.plugins"
- versionRange="[2.0,)">
- <configurator
- id="org.eclipse.m2e.jdt.javaConfigurator">
- </configurator>
- </mojo>
- <mojo
- artifactId="maven-resources-plugin"
- goals="resources,testResources"
- groupId="org.apache.maven.plugins"
- versionRange="[2.4,)">
- <configurator
- id="org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator">
- </configurator>
- </mojo>
+ <pluginExecution>
+ <filter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </filter>
+ <action>
+ <configurator>
+ <id>org.eclipse.m2e.jdt.javaConfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <filter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <versionRange>[2.4,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ <goal>testResources</goal>
+ </goals>
+ </filter>
+ <action>
+ <configurator>
+ <id>org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
</lifecycleMapping>
</extension>

Back to the top