Include older m2e plugins with m2e 1.0+ using life-cycle mapping?

Suminda Sirinath S. Dharmasena picture Suminda Sirinath S. Dharmasena · Jul 10, 2011 · Viewed 12.8k times · Source

I want to enable older plug ins not available in m2e v 1.0

I have added this to the POM but it does not work if there are multiple items.

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-dependency-plugin</artifactId>
                                    <version>[0.0.0,)</version>
                                    <goals>
                                        <goal>unpack</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>build-helper-maven-plugin</artifactId>
                                    <version>[0.0.0,)</version>
                                    <phase>generate-sources</phase>
                                    <goals>
                                        <goal>add-source</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

I have also tried the following variation.

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <lifecycleMappings>
                            <lifecycleMapping>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.apache.maven.plugins</groupId>
                                            <artifactId>maven-dependency-plugin</artifactId>
                                            <version>[0.0.0,)</version>
                                            <goals>
                                                <goal>unpack</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <execute />
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMapping>
                            <lifecycleMapping>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.codehaus.mojo</groupId>
                                            <artifactId>build-helper-maven-plugin</artifactId>
                                            <version>[0.0.0,)</version>
                                            <phase>generate-sources</phase>
                                            <goals>
                                                <goal>add-source</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <execute />
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMapping>
                        </lifecycleMappings>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

The error message I get is:

Cannot parse lifecycle mapping metadata for maven project MavenProject: com.sakriom:drools-context:0.0.1-SNAPSHOT @ D:\Documents and Settings.....\Workspaces\Eclipse 3.6 - Scala\DroolsContext\pom.xml Cause: Unrecognised tag: 'version' (position: START_TAG seen ...\r\n ... @10:22)

How is this error message decoded?

Answer

Justin Garrick picture Justin Garrick · Jul 15, 2011

"Cause: Unrecognised tag: 'version'" -- It's complaining about the <version>[0.0.0,)</version> tag because it doesn't belong inside of a <pluginExecutionFilter>. You should use <versionRange>[0.0.0,)</versionRange> instead.