Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladt2010-12-23 13:04:56 -0500
committervladt2010-12-23 13:05:33 -0500
commit8214d2532869ab675cfc6e9d935821e56fff727c (patch)
tree7e224e155a446caed35b31eddbc704d22e67492c
parent17897ec65e21b000520d812d1216889a998c7dd5 (diff)
downloadm2e-core-8214d2532869ab675cfc6e9d935821e56fff727c.tar.gz
m2e-core-8214d2532869ab675cfc6e9d935821e56fff727c.tar.xz
m2e-core-8214d2532869ab675cfc6e9d935821e56fff727c.zip
MNGECLIPSE-2680: Define modello model for lifecycle mapping metadata
-rw-r--r--default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml154
-rw-r--r--org.eclipse.m2e.core/.classpath1
-rw-r--r--org.eclipse.m2e.core/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--org.eclipse.m2e.core/pom.xml56
-rw-r--r--org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml97
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/lifecycle/LifecycleMappingFactory.java127
6 files changed, 308 insertions, 131 deletions
diff --git a/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml b/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
index 0ac84c10..e9c4a6ca 100644
--- a/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
+++ b/default-lifecycle-mapping-metadata/default-lifecycle-mapping-metadata.xml
@@ -2,21 +2,19 @@
<lifecycleMappingMetadata>
<lifecycleMappings>
<lifecycleMapping>
- <!-- The id matches the id declared in the eclipse extension for the
- lifecycle mapping -->
- <id>org.eclipse.m2e.jdt.JarLifecycleMapping</id>
<packagingType>war</packagingType>
+ <!-- The id matches the id declared in the eclipse extension for the lifecycle mapping -->
+ <lifecycleMappingId>org.eclipse.m2e.jdt.JarLifecycleMapping</lifecycleMappingId>
</lifecycleMapping>
<lifecycleMapping>
- <!-- The id matches the id declared in the eclipse extension for the
- lifecycle mapping -->
- <id>org.eclipse.m2e.jdt.JarLifecycleMapping</id>
<packagingType>nexus-plugin</packagingType>
+ <!-- The id matches the id declared in the eclipse extension for the lifecycle mapping -->
+ <lifecycleMappingId>org.eclipse.m2e.jdt.JarLifecycleMapping</lifecycleMappingId>
</lifecycleMapping>
</lifecycleMappings>
- <mojos>
- <mojo>
+ <pluginExecutions>
+ <pluginExecution>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<goals>
@@ -26,13 +24,12 @@
<versionRange>[2.0,)</versionRange>
<action>
<configurator>
- <!-- The id matches the id declared in the eclipse extension for
- the project configurator -->
+ <!-- The id matches the id declared in the eclipse extension for the project configurator -->
<id>org.eclipse.m2e.jdt.javaConfigurator</id>
</configurator>
</action>
- </mojo>
- <mojo>
+ </pluginExecution>
+ <pluginExecution>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<goals>
@@ -42,12 +39,133 @@
<versionRange>[2.4,)</versionRange>
<action>
<configurator>
- <!-- The id matches the id declared in the eclipse extension for
- the project configurator -->
- <id>org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator
- </id>
+ <!-- The id matches the id declared in the eclipse extension for the project configurator -->
+ <id>org.eclipse.m2e.core.project.configurator.MavenResourcesProjectConfigurator</id>
</configurator>
</action>
- </mojo>
- </mojos>
+ </pluginExecution>
+
+ <pluginExecution>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>provided-dependencies-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[1.4,)</versionRange>
+ <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>
+ <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>
+ <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>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <goals>
+ <goal>xsd</goal>
+ </goals>
+ <versionRange>[1.3,)</versionRange>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
</lifecycleMappingMetadata>
diff --git a/org.eclipse.m2e.core/.classpath b/org.eclipse.m2e.core/.classpath
index 798048dd..647144da 100644
--- a/org.eclipse.m2e.core/.classpath
+++ b/org.eclipse.m2e.core/.classpath
@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
+ <classpathentry kind="src" path="target/generated-sources/modello/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.m2e.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.core/.settings/org.eclipse.jdt.core.prefs
index 439e251d..149db3a0 100644
--- a/org.eclipse.m2e.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.m2e.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Wed Dec 15 13:33:33 EST 2010
+#Wed Dec 22 17:22:22 EST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -95,7 +95,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
diff --git a/org.eclipse.m2e.core/pom.xml b/org.eclipse.m2e.core/pom.xml
index f53abd90..b052e164 100644
--- a/org.eclipse.m2e.core/pom.xml
+++ b/org.eclipse.m2e.core/pom.xml
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2008 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
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- Copyright (c) 2008 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 -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -20,6 +17,10 @@
<packaging>eclipse-plugin</packaging>
<name>Maven Integration for Eclipse Plug-in</name>
+
+ <properties>
+ <modello.version>1.5-SNAPSHOT</modello.version>
+ </properties>
<build>
<sourceDirectory>src</sourceDirectory>
@@ -32,6 +33,43 @@
</includes>
</resource>
</resources>
- </build>
+ <plugins>
+ <plugin>
+ <groupId>org.maven.ide.eclipse</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>0.10.0</version>
+ <configuration>
+ <mappingId>org.sonatype.tycho.m2e.tychoLifecycleMapping</mappingId>
+ <configurators>
+ <configurator id='org.maven.ide.eclipse.modello.modelloConfigurator' />
+ </configurators>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>${modello.version}</version>
+ <executions>
+ <execution>
+ <id>standard</id>
+ <goals>
+ <goal>java</goal>
+ <goal>xpp3-reader</goal>
+ <goal>xpp3-writer</goal>
+ </goals>
+ <configuration>
+ <version>1.0.0</version>
+ <models>
+ <model>src/main/mdo/lifecycle-mapping-metadata-model.xml</model>
+ </models>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <useJava5>true</useJava5>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
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
new file mode 100644
index 00000000..f623e63b
--- /dev/null
+++ b/org.eclipse.m2e.core/src/main/mdo/lifecycle-mapping-metadata-model.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+
+<model xmlns="http://modello.codehaus.org/MODELLO/1.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.4.1 http://modello.codehaus.org/xsd/modello-1.4.1.xsd">
+
+ <id>lifecycle-mapping-metadata-model</id>
+ <name>LifecycleMappingMetadataData</name>
+
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.eclipse.m2e.core.internal.lifecycle.model</value>
+ </default>
+ </defaults>
+
+ <classes>
+ <class rootElement="true" xml.tagName="lifecycleMappingMetadata">
+ <name>LifecycleMappingMetadataData</name>
+ <fields>
+ <field xml.transient="true">
+ <name>groupId</name>
+ <type>String</type>
+ </field>
+ <field xml.transient="true">
+ <name>artifactId</name>
+ <type>String</type>
+ </field>
+ <field xml.transient="true">
+ <name>version</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>lifecycleMappings</name>
+ <association>
+ <type>LifecycleMappingData</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field>
+ <name>pluginExecutions</name>
+ <association>
+ <type>PluginExecutionData</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ </fields>
+ </class>
+
+ <class xml.tagName="lifecycleMapping" xml.standaloneRead="true">
+ <name>LifecycleMappingData</name>
+ <fields>
+ <field required="true">
+ <name>packagingType</name>
+ <type>String</type>
+ </field>
+ <field required="true">
+ <name>lifecycleMappingId</name>
+ <type>String</type>
+ </field>
+ <field>
+ <name>lifecycleMappingVersionRange</name>
+ <type>String</type>
+ </field>
+ </fields>
+ </class>
+
+ <class xml.tagName="pluginExecution" xml.standaloneRead="true">
+ <name>PluginExecutionData</name>
+ <fields>
+ <field required="true">
+ <name>groupId</name>
+ <type>String</type>
+ </field>
+ <field required="true">
+ <name>artifactId</name>
+ <type>String</type>
+ </field>
+ <field required="true">
+ <name>versionRange</name>
+ <type>String</type>
+ </field>
+ <field required="true">
+ <name>goals</name>
+ <type>Set</type>
+ <association>
+ <type>String</type>
+ <multiplicity>*</multiplicity>
+ </association>
+ </field>
+ <field required="true">
+ <name>action</name>
+ <type>DOM</type>
+ </field>
+ </fields>
+ </class>
+ </classes>
+</model>
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 204073db..6e5db911 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
@@ -14,11 +14,10 @@ package org.eclipse.m2e.core.internal.lifecycle;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -29,9 +28,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.apache.maven.artifact.Artifact;
@@ -45,6 +42,10 @@ import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.core.IMavenConstants;
import org.eclipse.m2e.core.core.MavenLogger;
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.io.xpp3.LifecycleMappingMetadataDataXpp3Reader;
import org.eclipse.m2e.core.internal.project.IgnoreMojoProjectConfiguration;
import org.eclipse.m2e.core.internal.project.MojoExecutionProjectConfigurator;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
@@ -71,26 +72,16 @@ public class LifecycleMappingFactory {
private static final String ELEMENT_LIFECYCLE_MAPPING = "lifecycleMapping"; //$NON-NLS-1$
- private static final String ELEMENT_LIFECYCLE_MAPPING_METADATA = "lifecycleMappingMetadata"; //$NON-NLS-1$
-
private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
private static final String ATTR_PACKAGING_TYPE = "packaging-type"; //$NON-NLS-1$
private static final String ATTR_ID = "id"; //$NON-NLS-1$
- private static final String ELEMENT_LIFECYCLE_MAPPINGS = "lifecycleMappings"; //$NON-NLS-1$
-
- private static final String ELEMENT_PACKAGING_TYPE = "packagingType"; //$NON-NLS-1$
-
private static final String ELEMENT_CONFIGURATOR = "configurator"; //$NON-NLS-1$
- private static final String ELEMENT_MOJOS = "mojos"; //$NON-NLS-1$
-
private static final String ELEMENT_MOJO = "mojo"; //$NON-NLS-1$
- private static final String ELEMENT_ACTION = "action"; //$NON-NLS-1$
-
private static final String ELEMENT_IGNORE = "ignore"; //$NON-NLS-1$
private static final String ELEMENT_EXECUTE = "execute";
@@ -107,8 +98,6 @@ public class LifecycleMappingFactory {
private static final String ATTR_GOALS = "goals";
- private static final String ATTR_GOAL = "goal";
-
private static final String LIFECYCLE_MAPPING_METADATA_CLASSIFIER = "lifecycle-mapping-metadata";
/**
@@ -407,11 +396,8 @@ public class LifecycleMappingFactory {
if(file == null || !file.exists() || !file.canRead()) {
throw new LifecycleMappingConfigurationException("Cannot find file for artifact " + artifact);
}
- FileInputStream input = null;
try {
- input = new FileInputStream(file);
- Xpp3Dom dom = Xpp3DomBuilder.build(new XmlStreamReader(input));
- return createLifecycleMappingMetadata(groupId, artifactId, version, dom);
+ return createLifecycleMappingMetadata(groupId, artifactId, version, file);
} catch(IOException e) {
throw new LifecycleMappingConfigurationException("Cannot read lifecycle mapping metadata for " + artifact, e);
} catch(XmlPullParserException e) {
@@ -419,8 +405,6 @@ public class LifecycleMappingFactory {
e);
} catch(RuntimeException e) {
throw new LifecycleMappingConfigurationException("Cannot load lifecycle mapping metadata for " + artifact, e);
- } finally {
- IOUtil.close(input);
}
} catch(CoreException ex) {
throw new LifecycleMappingConfigurationException(ex);
@@ -428,90 +412,29 @@ public class LifecycleMappingFactory {
}
private static LifecycleMappingMetadata createLifecycleMappingMetadata(String groupId, String artifactId,
- String version, Xpp3Dom configuration) {
- if(configuration == null || !ELEMENT_LIFECYCLE_MAPPING_METADATA.equals(configuration.getName())) {
- throw new LifecycleMappingConfigurationException("Root element must be " + ELEMENT_LIFECYCLE_MAPPING_METADATA);
- }
-
- // Load lifecycle mappings
- LifecycleMappingMetadata metadata = new LifecycleMappingMetadata(groupId, artifactId, version);
- Xpp3Dom lifecycleMappings = configuration.getChild(ELEMENT_LIFECYCLE_MAPPINGS);
- if(lifecycleMappings != null) {
- for(Xpp3Dom lifecycleMapping : lifecycleMappings.getChildren(ELEMENT_LIFECYCLE_MAPPING)) {
- Xpp3Dom child = lifecycleMapping.getChild(ELEMENT_PACKAGING_TYPE);
- if(child == null) {
- throw new LifecycleMappingConfigurationException("A packaging type must be specified for lifecycle mapping");
- }
- String packagingType = child.getValue();
- if(packagingType == null || packagingType.trim().length() == 0) {
- throw new LifecycleMappingConfigurationException("A packaging type must be specified for lifecycle mapping");
- }
- child = lifecycleMapping.getChild(ATTR_ID);
- if(child == null) {
- throw new LifecycleMappingConfigurationException("An id must be specified for lifecycle mapping");
- }
- String lifecycleMappingId = child.getValue();
- if(lifecycleMappingId == null || lifecycleMappingId.trim().length() == 0) {
- throw new LifecycleMappingConfigurationException("An id must be specified for lifecycle mapping");
- }
- metadata.addLifecycleMapping(packagingType, lifecycleMappingId);
- }
- }
+ String version, File configuration) throws IOException, XmlPullParserException {
+ InputStream in = new FileInputStream(configuration);
+ try {
+ LifecycleMappingMetadataData lifecycleMappingMetadataData = new LifecycleMappingMetadataDataXpp3Reader().read(in);
+ LifecycleMappingMetadata metadata = new LifecycleMappingMetadata(groupId, artifactId, version);
- // Load mojo/plugin executions
- Xpp3Dom mojos = configuration.getChild(ELEMENT_MOJOS);
- if(mojos != null) {
- for(Xpp3Dom mojo : mojos.getChildren(ELEMENT_MOJO)) {
- metadata.addPluginExecution(createPluginExecutionMetadata(mojo));
+ for(LifecycleMappingData lifecycleMappingData : lifecycleMappingMetadataData.getLifecycleMappings()) {
+ metadata.addLifecycleMapping(lifecycleMappingData.getPackagingType(),
+ lifecycleMappingData.getLifecycleMappingId());
}
- }
-
- return metadata;
- }
- private static PluginExecutionMetadata createPluginExecutionMetadata(Xpp3Dom configuration) {
- PluginExecutionFilter filter = createPluginExecutionFilter(configuration);
- Xpp3Dom actionDom = configuration.getChild(ELEMENT_ACTION);
- if(actionDom == null) {
- throw new LifecycleMappingConfigurationException("Element " + ELEMENT_ACTION + " is missing.");
- }
- if(actionDom.getChild(ELEMENT_IGNORE) != null) {
- return new PluginExecutionMetadata(filter, PluginExecutionAction.IGNORE, null /*configuration*/);
- }
- if(actionDom.getChild(ELEMENT_EXECUTE) != null) {
- return new PluginExecutionMetadata(filter, PluginExecutionAction.EXECUTE, actionDom.getChild(ELEMENT_EXECUTE));
- }
- if(actionDom.getChild(ELEMENT_CONFIGURATOR) != null) {
- return new PluginExecutionMetadata(filter, PluginExecutionAction.CONFIGURATOR,
- actionDom.getChild(ELEMENT_CONFIGURATOR));
- }
-
- throw new LifecycleMappingConfigurationException("An action must be specified");
- }
-
- private static PluginExecutionFilter createPluginExecutionFilter(Xpp3Dom configuration) {
- String groupId = null;
- Xpp3Dom child = configuration.getChild(ATTR_GROUPID);
- if(child != null) {
- groupId = child.getValue();
- }
- String artifactId = null;
- child = configuration.getChild(ATTR_ARTIFACTID);
- if(child != null) {
- artifactId = child.getValue();
- }
- String versionRange = null;
- child = configuration.getChild(ATTR_VERSIONRANGE);
- if(child != null) {
- versionRange = child.getValue();
- }
- Set<String> goals = new LinkedHashSet<String>();
- child = configuration.getChild(ATTR_GOALS);
- if(child != null) {
- for(Xpp3Dom childGoal : child.getChildren(ATTR_GOAL)) {
- goals.add(childGoal.getValue());
+ 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);
+ metadata.addPluginExecution(pluginExecutionMetadata);
}
+
+ return metadata;
+ } finally {
+ IOUtil.close(in);
}
- return new PluginExecutionFilter(groupId, artifactId, versionRange, goals);
}
}

Back to the top