| <?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>LifecycleMappingMetadataSource</name> |
| |
| <defaults> |
| <default> |
| <key>package</key> |
| <value>org.eclipse.m2e.core.internal.lifecyclemapping.model</value> |
| </default> |
| </defaults> |
| |
| <classes> |
| <class rootElement="true" xml.tagName="lifecycleMappingMetadata"> |
| <name>LifecycleMappingMetadataSource</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>LifecycleMappingMetadata</type> |
| <multiplicity>*</multiplicity> |
| </association> |
| </field> |
| <field> |
| <name>pluginExecutions</name> |
| <association> |
| <type>PluginExecutionMetadata</type> |
| <multiplicity>*</multiplicity> |
| </association> |
| </field> |
| </fields> |
| <codeSegments> |
| <codeSegment> |
| <code><![CDATA[ |
| private transient Object source; |
| public void setSource(Object source) { |
| this.source = source; |
| } |
| public Object getSource() { |
| return this.source; |
| } |
| ]]> |
| </code> |
| </codeSegment> |
| </codeSegments> |
| </class> |
| |
| <class xml.tagName="lifecycleMapping" xml.standaloneRead="true"> |
| <name>LifecycleMappingMetadata</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> |
| <field> |
| <name>pluginExecutions</name> |
| <association> |
| <type>PluginExecutionMetadata</type> |
| <multiplicity>*</multiplicity> |
| </association> |
| </field> |
| </fields> |
| <codeSegments> |
| <codeSegment> |
| <code><![CDATA[ |
| private transient LifecycleMappingMetadataSource source; |
| public void setSource(LifecycleMappingMetadataSource source) { |
| this.source = source; |
| } |
| public LifecycleMappingMetadataSource getSource() { |
| return this.source; |
| } |
| ]]> |
| </code> |
| </codeSegment> |
| </codeSegments> |
| </class> |
| |
| <class xml.tagName="pluginExecutionFilter" xml.standaloneRead="true" java.clone="deep"> |
| <name>PluginExecutionFilter</name> |
| <fields> |
| <field required="true"> |
| <name>groupId</name> |
| <identifier>true</identifier> |
| <type>String</type> |
| </field> |
| <field required="true"> |
| <name>artifactId</name> |
| <identifier>true</identifier> |
| <type>String</type> |
| </field> |
| <field required="true" java.setter="false"> |
| <name>versionRange</name> |
| <identifier>true</identifier> |
| <type>String</type> |
| </field> |
| <field required="true"> |
| <name>goals</name> |
| <identifier>true</identifier> |
| <type>Set</type> |
| <association> |
| <type>String</type> |
| <multiplicity>*</multiplicity> |
| </association> |
| </field> |
| <field> |
| <name>parameters</name> |
| <type>Map</type> |
| <association> |
| <type>String</type> |
| <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 transient org.apache.maven.artifact.versioning.VersionRange parsedVersionRange; |
| |
| public void setVersionRange(String versionRange) { |
| this.versionRange = versionRange; |
| try { |
| 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); |
| } |
| } |
| |
| private void checkAllFieldsSet() { |
| if (groupId==null || artifactId==null || versionRange==null || goals==null || goals.isEmpty() ){ |
| throw new IllegalArgumentException( |
| "Missing parameter for pluginExecutionFilter. " + |
| "groupId, artifactId, versionRange and goals must be specificed, but found: "+this); |
| } |
| } |
| |
| /** |
| * Returns true if mojoExecution matches this key or false otherwise. This method does not consider mojo execution |
| * parameters. |
| */ |
| public boolean match(org.eclipse.m2e.core.project.configurator.MojoExecutionKey mojoExecution) { |
| checkAllFieldsSet(); |
| 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==null) { |
| try { |
| 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); |
| } |
| } |
| |
| if(!parsedVersionRange.containsVersion(version)) { |
| return false; |
| } |
| |
| return getGoals().contains(mojoExecution.getGoal()); |
| } |
| ]]> |
| </code> |
| </codeSegment> |
| </codeSegments> |
| </class> |
| |
| <class xml.tagName="pluginExecution" xml.standaloneRead="true" java.clone="deep"> |
| <name>PluginExecutionMetadata</name> |
| <interfaces> |
| <interface>org.eclipse.m2e.core.lifecyclemapping.model.IPluginExecutionMetadata</interface> |
| </interfaces> |
| <fields> |
| <field required="true" xml.tagName="pluginExecutionFilter"> |
| <name>filter</name> |
| <association> |
| <type>PluginExecutionFilter</type> |
| <multiplicity>1</multiplicity> |
| </association> |
| </field> |
| <field required="true" xml.tagName="action"> |
| <name>actionDom</name> |
| <type>DOM</type> |
| </field> |
| <field required="false" xml.tagName="comment"> |
| <name>comment</name> |
| <type>String</type> |
| <description> |
| Arbitrary comment that describes the mapping. The comment is not interpreted by m2e in any way. |
| @since 1.2 |
| </description> |
| </field> |
| </fields> |
| <codeSegments> |
| <codeSegment> |
| <code><![CDATA[ |
| public org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction getAction() { |
| org.codehaus.plexus.util.xml.Xpp3Dom actionDom = (org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom(); |
| org.codehaus.plexus.util.xml.Xpp3Dom childDom = actionDom == null ? null : actionDom.getChild(0); |
| if(childDom == null) return org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction.configurator; |
| return org.eclipse.m2e.core.lifecyclemapping.model.PluginExecutionAction.valueOf(childDom.getName()); |
| } |
| |
| public org.codehaus.plexus.util.xml.Xpp3Dom getConfiguration() { |
| org.codehaus.plexus.util.xml.Xpp3Dom actionDom = ((org.codehaus.plexus.util.xml.Xpp3Dom) getActionDom()); |
| return actionDom == null ? null : actionDom.getChild(0); |
| } |
| |
| private transient LifecycleMappingMetadataSource source; |
| public void setSource(LifecycleMappingMetadataSource source) { |
| this.source = source; |
| } |
| public LifecycleMappingMetadataSource getSource() { |
| return this.source; |
| } |
| ]]> |
| </code> |
| </codeSegment> |
| </codeSegments> |
| </class> |
| </classes> |
| </model> |