Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladt2010-12-23 18:15:12 -0500
committervladt2010-12-23 18:15:12 -0500
commiteb8528f1277be7070ab5ffb993f4a5e06b82f5fe (patch)
tree5cdf1ea6bfba25b8e56054595abecce1b221e8a6
parenta936df3688654f34d3dceab40be9d314201e008b (diff)
downloadm2e-core-eb8528f1277be7070ab5ffb993f4a5e06b82f5fe.tar.gz
m2e-core-eb8528f1277be7070ab5ffb993f4a5e06b82f5fe.tar.xz
m2e-core-eb8528f1277be7070ab5ffb993f4a5e06b82f5fe.zip
MNGECLIPSE-2681: Use modello model in lifecycle mapping eclipse extensions
-rw-r--r--default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml190
-rw-r--r--org.eclipse.m2e.core/plugin.xml15
-rw-r--r--org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml2
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java28
-rw-r--r--org.eclipse.m2e.jdt/plugin.xml8
5 files changed, 136 insertions, 107 deletions
diff --git a/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml b/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
index e9c4a6ca..a6f03206 100644
--- a/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
+++ b/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
@@ -15,13 +15,15 @@
<pluginExecutions>
<pluginExecution>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- <versionRange>[2.0,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ <versionRange>[2.0,)</versionRange>
+ </pluginExecutionFilter>
<action>
<configurator>
<!-- The id matches the id declared in the eclipse extension for the project configurator -->
@@ -30,13 +32,15 @@
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <goals>
- <goal>resources</goal>
- <goal>testResources</goal>
- </goals>
- <versionRange>[2.4,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <goals>
+ <goal>resources</goal>
+ <goal>testResources</goal>
+ </goals>
+ <versionRange>[2.4,)</versionRange>
+ </pluginExecutionFilter>
<action>
<configurator>
<!-- The id matches the id declared in the eclipse extension for the project configurator -->
@@ -44,125 +48,147 @@
</configurator>
</action>
</pluginExecution>
-
+
<pluginExecution>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>provided-dependencies-maven-plugin</artifactId>
- <goals>
- <goal>generate</goal>
- </goals>
- <versionRange>[1.4,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>provided-dependencies-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[1.4,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>app-lifecycle-maven-plugin</artifactId>
- <goals>
- <goal>check-dependencies</goal>
- </goals>
- <versionRange>[1.1,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>app-lifecycle-maven-plugin</artifactId>
+ <goals>
+ <goal>check-dependencies</goal>
+ </goals>
+ <versionRange>[1.1,)</versionRange>
+ </pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>app-lifecycle-maven-plugin</artifactId>
- <goals>
- <goal>generate-metadata</goal>
- <goal>inject-artifact-handler</goal>
- </goals>
- <versionRange>[1.1,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>app-lifecycle-maven-plugin</artifactId>
+ <goals>
+ <goal>generate-metadata</goal>
+ <goal>inject-artifact-handler</goal>
+ </goals>
+ <versionRange>[1.1,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <goals>
- <goal>unpack</goal>
- </goals>
- <versionRange>[2.0,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <versionRange>[2.0,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.codehaus.modello</groupId>
- <artifactId>modello-maven-plugin</artifactId>
- <goals>
- <goal>xsd</goal>
- </goals>
- <versionRange>[1.3,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <goals>
+ <goal>xsd</goal>
+ </goals>
+ <versionRange>[1.3,)</versionRange>
+ </pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <goals>
- <goal>enforce</goal>
- </goals>
- <versionRange>[1.0,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <versionRange>[1.0,)</versionRange>
+ </pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>maven-enunciate-plugin</artifactId>
- <goals>
- <goal>docs</goal>
- </goals>
- <versionRange>[1.20-SONATYPE-r919,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.enunciate</groupId>
+ <artifactId>maven-enunciate-plugin</artifactId>
+ <goals>
+ <goal>docs</goal>
+ </goals>
+ <versionRange>[1.20-SONATYPE-r919,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-test-environment-maven-plugin</artifactId>
- <goals>
- <goal>setup-environment</goal>
- </goals>
- <versionRange>[1.6-SNAPSHOT,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-test-environment-maven-plugin</artifactId>
+ <goals>
+ <goal>setup-environment</goal>
+ </goals>
+ <versionRange>[1.6-SNAPSHOT,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-invoker-plugin</artifactId>
- <goals>
- <goal>install</goal>
- </goals>
- <versionRange>[1.6-SONATYPE-r940877,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <versionRange>[1.6-SONATYPE-r940877,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>net.sf.alchim</groupId>
- <artifactId>yuicompressor-maven-plugin</artifactId>
- <goals>
- <goal>compress</goal>
- </goals>
- <versionRange>[0.7.1,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>net.sf.alchim</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <goals>
+ <goal>compress</goal>
+ </goals>
+ <versionRange>[0.7.1,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>yuicompressor-maven-plugin</artifactId>
- <goals>
- <goal>aggregate</goal>
- </goals>
- <versionRange>[0.0.1,)</versionRange>
+ <pluginExecutionFilter>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <versionRange>[0.0.1,)</versionRange>
+ </pluginExecutionFilter>
<action>
<ignore />
</action>
diff --git a/org.eclipse.m2e.core/plugin.xml b/org.eclipse.m2e.core/plugin.xml
index b49be2c6..7463559b 100644
--- a/org.eclipse.m2e.core/plugin.xml
+++ b/org.eclipse.m2e.core/plugin.xml
@@ -606,12 +606,15 @@
class="org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator"
id="org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator"
name="Maven Resources Project Configurator">
- <mojo
- artifactId="maven-resources-plugin"
- goals="resources,testResources"
- groupId="org.apache.maven.plugins"
- versionRange="[2.4,)">
- </mojo>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <versionRange>[2.4,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ <goal>testResources</goal>
+ </goals>
+ </pluginExecutionFilter>
</configurator>
</extension>
</plugin>
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 e4dfa4eb..e57c162e 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
@@ -141,7 +141,7 @@
<class xml.tagName="pluginExecution" xml.standaloneRead="true">
<name>PluginExecutionData</name>
<fields>
- <field required="true">
+ <field required="true" xml.tagName="pluginExecutionFilter">
<name>filter</name>
<association>
<type>PluginExecutionFilter</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 b42d3ce1..850364df 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
@@ -83,7 +83,7 @@ public class LifecycleMappingFactory {
private static final String ELEMENT_PLUGIN_EXECUTION = "pluginExecution"; //$NON-NLS-1$
- private static final String ELEMENT_MOJO = "mojo"; //$NON-NLS-1$
+ private static final String ELEMENT_PLUGIN_EXECUTION_FILTER = "pluginExecutionFilter"; //$NON-NLS-1$
private static final String ELEMENT_RUN_ON_INCREMENTAL = "runOnIncremental";
@@ -93,10 +93,6 @@ public class LifecycleMappingFactory {
private static final String ATTR_VERSION = "version";
- private static final String ATTR_VERSIONRANGE = "versionRange";
-
- private static final String ATTR_GOALS = "goals";
-
private static final String LIFECYCLE_MAPPING_METADATA_CLASSIFIER = "lifecycle-mapping-metadata";
/**
@@ -192,12 +188,16 @@ public class LifecycleMappingFactory {
return new MojoExecutionProjectConfigurator(pluginExecutionMetadata.getFilter(), runOnIncremental);
}
- private static PluginExecutionFilter createPluginExecutionFilter(IConfigurationElement configuration) {
- String groupId = configuration.getAttribute(ATTR_GROUPID);
- String artifactId = configuration.getAttribute(ATTR_ARTIFACTID);
- String versionRange = configuration.getAttribute(ATTR_VERSIONRANGE);
- String goals = configuration.getAttribute(ATTR_GOALS);
- return new PluginExecutionFilter(groupId, artifactId, versionRange, goals);
+ private static PluginExecutionFilter createPluginExecutionFilter(IConfigurationElement configurationElement) {
+ String configurationElementXml = toXml(configurationElement);
+ try {
+ return new LifecycleMappingMetadataDataXpp3Reader().readPluginExecutionFilter(new StringReader(
+ configurationElementXml));
+ } catch(IOException e) {
+ throw new LifecycleMappingConfigurationException("Cannot read plugin execution filter", e);
+ } catch(XmlPullParserException e) {
+ throw new LifecycleMappingConfigurationException("Cannot parse plugin execution filter", e);
+ }
}
public static ILifecycleMapping getLifecycleMapping(String mappingId) {
@@ -243,7 +243,7 @@ public class LifecycleMappingFactory {
configurator.setConsole(plugin.getConsole());
if(!bare) {
- for(IConfigurationElement mojo : element.getChildren(ELEMENT_MOJO)) {
+ for(IConfigurationElement mojo : element.getChildren(ELEMENT_PLUGIN_EXECUTION_FILTER)) {
configurator.addPluginExecutionFilter(createPluginExecutionFilter(mojo));
}
}
@@ -292,7 +292,7 @@ public class LifecycleMappingFactory {
configurator.setMarkerManager(plugin.getMavenMarkerManager());
configurator.setConsole(plugin.getConsole());
- for(IConfigurationElement mojo : element.getChildren(ELEMENT_MOJO)) {
+ for(IConfigurationElement mojo : element.getChildren(ELEMENT_PLUGIN_EXECUTION_FILTER)) {
configurator.addPluginExecutionFilter(createPluginExecutionFilter(mojo));
}
@@ -309,7 +309,7 @@ public class LifecycleMappingFactory {
}
private static boolean isConfiguratorEnabledFor(IConfigurationElement configuration, MojoExecution execution) {
- for(IConfigurationElement mojo : configuration.getChildren(ELEMENT_MOJO)) {
+ for(IConfigurationElement mojo : configuration.getChildren(ELEMENT_PLUGIN_EXECUTION_FILTER)) {
if(createPluginExecutionFilter(mojo).match(execution)) {
return true;
}
diff --git a/org.eclipse.m2e.jdt/plugin.xml b/org.eclipse.m2e.jdt/plugin.xml
index 8319de3f..dc4f9235 100644
--- a/org.eclipse.m2e.jdt/plugin.xml
+++ b/org.eclipse.m2e.jdt/plugin.xml
@@ -16,7 +16,7 @@
name="%lifecycleMapping.jar.name"
packaging-type="jar">
<pluginExecution>
- <filter>
+ <pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
@@ -24,7 +24,7 @@
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
- </filter>
+ </pluginExecutionFilter>
<action>
<configurator>
<id>org.eclipse.m2e.jdt.javaConfigurator</id>
@@ -32,7 +32,7 @@
</action>
</pluginExecution>
<pluginExecution>
- <filter>
+ <pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<versionRange>[2.4,)</versionRange>
@@ -40,7 +40,7 @@
<goal>resources</goal>
<goal>testResources</goal>
</goals>
- </filter>
+ </pluginExecutionFilter>
<action>
<configurator>
<id>org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator</id>

Back to the top