Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Can't get simple lifecycleMapping to work in plugin

I'm using m2e 1.0 and I'm running into a small problem (or, more likely, lack of understanding on my part) with some lifecycleMapping configuration. Here is the situation:

We have a custom maven packaging type (tomcat-deployable). When a project with that packaging type is imported into Eclipse, we want the resources:resources goal to be run on it (and nothing else - it isn't a Java project). I got it working by adding the following to the POM:

<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-resources-plugin</artifactId>
<versionRange>[2.0.0,]</versionRange>
<goals>
<goal>resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

This works fine for one project, but I want to make a plugin to handle this so that every project we have doesn't have to do this. So, in one of our plugins, I added the following:

In lifecycle-mapping-metadata.xml:

<lifecycleMappingMetadata>
<lifecycleMappings>
<lifecycleMapping>
<packagingType>tomcat-deployable</packagingType>
<lifecycleMappingId>org.lds.stack.ide.tomcatDeployableLifecycleMapping</lifecycleMappingId>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<versionRange>[2.0.0,)</versionRange>
<goals>
<goal>resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMapping>
</lifecycleMappings>
</lifecycleMappingMetadata>

In the corresponding plugin.xml:

<extension point="org.eclipse.m2e.core.lifecycleMappingMetadataSource" />
<extension point="org.eclipse.m2e.core.lifecycleMappings">
   <lifecycleMapping
         class="org.lds.stack.ide.TomcatDeployableLifecycleMapping"
         id="org.lds.stack.ide.tomcatDeployableLifecycleMapping"
         name="Tomcat Deployable Lifecycle Mapping" />
</extension>

This doesn't cause the resources goal to be run, however. I do see the following in the Eclipse logs:

11:47:15.560 [Worker-10] INFO  o.e.m.c.u.i.UpdateConfigurationJob - Update started
11:47:15.562 [Worker-10] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshing: [/keystone-deploy/pom.xml]
11:47:15.567 [Worker-10] DEBUG o.e.m.c.internal.embedder.MavenImpl - Reading Maven project: C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml
11:47:15.592 [Worker-10] DEBUG o.e.m.c.internal.embedder.MavenImpl - Read Maven project: C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml in 25 ms
11:47:15.814 [Worker-10] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loading lifecycle mapping for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml.
11:47:15.878 [Worker-10] INFO  o.e.m.c.i.l.LifecycleMappingFactory - Using org.lds.stack.ide.tomcatDeployableLifecycleMapping lifecycle mapping for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml.
11:47:15.878 [Worker-10] DEBUG o.e.m.c.i.l.LifecycleMappingFactory - Loaded lifecycle mapping in 64 ms for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml.
11:47:15.879 [Worker-10] DEBUG o.e.m.c.i.p.r.DefaultMavenDependencyResolver - Resolving dependencies for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml
11:47:15.879 [Worker-10] DEBUG o.e.m.c.internal.embedder.MavenImpl - Reading Maven project: C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml
11:47:15.911 [Worker-10] DEBUG o.e.m.c.internal.embedder.MavenImpl - Read Maven project: C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml in 32 ms
11:47:15.912 [Worker-10] DEBUG o.e.m.c.i.p.r.DefaultMavenDependencyResolver - Resolved dependencies for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml in 33 ms
11:47:15.913 [Worker-10] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshed: [/keystone-deploy/pom.xml]
11:47:15.983 [Worker-10] DEBUG o.e.m.c.i.p.ProjectConfigurationManager - Updating project configuration for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml.
11:47:15.986 [Worker-10] DEBUG o.e.m.c.i.p.ProjectConfigurationManager - Updated project configuration for MavenProject: org.lds.keystone:keystone-deploy:1.0 @ C:\dev\eclipse-indigo\runtime-ldstech\keystone\deploy\pom.xml in 3 ms.
11:47:15.986 [Worker-10] INFO  o.e.m.c.u.i.UpdateConfigurationJob - Update completed: 0 sec

So, it appears to be picking up my lifecycle mapping, but nothing actually happens as far as I can tell.

Any ideas as to what I'm missing?

Thanks,

- Spencer

Back to the top