Skip to main content

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

The problem is that the information in the POM doesn't give enough control compared to the plugin. You can't specify such things as conditional execution, regeneration of code, generated-source directories, etc. All things you would need to be able to specify if you were to give complete control, and besides all these things are Eclipse specific, they don't have an affect on the build it self.

I'd prefer a preference option in the IDE that controlled how the behavior acted, and the preference order.

Dave

On 06/29/2011 01:47 AM, Igor Fedorenko wrote:
Yes, m2e extensions provide the canonical mapping used by default.
Still, nobody knows how to work on a project better than project
developers. For example, I may choose to <ignore/> certain maven
plugins, like findbugs-maven-plugin, when working on my project inside
IDE. Another example is to be able to select from alternative mappings
available for the same plugin.

--
Regards,
Igor



On 11-06-29 9:09 AM, Milos Kleint wrote:
but isn't the eclipse plugin supposed to be the "canonical" solution that is correct and complete and suitable for all? in what situation would someone want to override that? Especially since it appears to me from the discussions that execute or ignore resolutions in the pom are often not the entirely correct solutions to the problem of missing mapping..

Milos

On Jun 29, 2011, at 5:11 AM, Igor Fedorenko wrote:

This is expected (see [1]) and I believe desired as projects should be
possible to force certain IDE behaviour. Do you think better logging of
lifecycle mapping configuration would make this more obvious?

[1] http://wiki.eclipse.org/M2E_plugin_execution_not_covered#metadata_source_lookup_order

--
Regards,
Igor

On 11-06-29 2:23 AM, David Carver wrote:
Igor, one thing I found is that if there is LifecycleMappingMetadata in a POM for a particular plugin, it takes precedence and overrides even if
there is an eclipse plugin that specifies the LifecycleMapping. I had
this happen to me while I was trying to develop a m2e configuration
plugin. Drove me nuts until I found the lifecycle mapping that had been
added to the parent pom.

Dave

On 06/28/2011 02:38 AM, Igor Fedorenko wrote:
Can you please open a bugreport and explain what happened? At very least m2e should provide enough logging to allow troubleshooting of problems
like this.

--
Regards,
Igor

On 11-06-28 1:00 AM, Spencer Uresk wrote:
Actually, this turned out to be another plugin defining some improper
pluginExecution configuration, which silently broke a lot of stuff.
Sorry for the false alarm.

- Spencer

On Mon, Jun 27, 2011 at 1:35 PM, Spencer Uresk<suresk@xxxxxxxxx
<mailto:suresk@xxxxxxxxx>>  wrote:

Thanks, but I already have the extension point included. I also have
added the lifecycle-mapping-metadata.xml entry to build.properties,
but neglected to mention that in my original email.

- Spencer


On Mon, Jun 27, 2011 at 1:09 PM, David Carver<d_a_carver@xxxxxxxxx
<mailto:d_a_carver@xxxxxxxxx>>  wrote:

__
All you need to do is include the extension point as follows:


<extension

point="org.eclipse.m2e.core.lifecycleMappingMetadataSource">
</extension>

And make sure you have your lifecycle-mapping-metadata.xml file
in the root of your contributing plugin. (Don't forget to add it
to the build.properties file as well so it gets included).

Dave


On 06/27/2011 03:04 PM, Spencer Uresk wrote:
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
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top