Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] Plugin development help : generate-sources and add to classpath

Hello m2e users and devs,
The other day I was importing a hudson plugin source code into Eclipse (Kepler service release 1, build id 20130919-0819 , m2e 1.4.0.20130601-0317), and I noticed that I had to first 
* invoke mvn generate-sources (from Eclipse using m2e, that worked fine)
* right click on target/generate-sources/localizer and choose "Build path -> Use as source folder.."
so that it compiles fine... 
In fact, it's just that for i18n, there's this maven plugin :

        <plugin>

          <groupId>org.jvnet.localizer</groupId>

          <artifactId>maven-localizer-plugin</artifactId>

          <version>1.14</version>

        </plugin>

that binds a goal named "generate" to "generate-sources" that will process resources named Message*.properties in the resources, to generate classes with the same name.

Since m2e does not seem to "magically" run that phase and add the generated sources to the classpath, I started creating a plugin for that.

But my plugin is ignored by m2e...

Here are its 2 classes and plugin.xml and lifecycle-mapping-metadata.xml :

https://gist.github.com/anthonydahanne/8787256

m2e does not do anything about this plugin, it just ignores it , see the log when I do Maven->Update project on a Hudson plugin :

11:39:48.507 [Worker-8] DEBUG o.e.m.c.i.builder.MavenBuilder - Building project build-timeout

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Build participants for MavenProject: org.jenkins-ci.plugins:build-timeout:1.11-SNAPSHOT @ /Users/anthony/workspaces/jenkins/build-timeout-plugin/pom.xml

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.jenkins-ci.tools:maven-hpi-plugin:1.90:validate (execution: default-validate, phase: validate)

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Action: execute

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-enforcer-plugin:1.0.1:enforce (execution: enforce-maven, phase: validate)

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Action: ignore

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.apache.maven.plugins:maven-enforcer-plugin:1.0.1:display-info (execution: display-info, phase: validate)

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Action: ignore

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.jvnet.localizer:maven-localizer-plugin:1.14:generate (execution: default, phase: generate-sources)

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Action: execute

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Mojo execution key: org.codehaus.mojo:antlr-maven-plugin:2.1:generate (execution: default, phase: generate-sources)

11:39:48.518 [Worker-8] DEBUG o.e.m.c.p.c.AbstractCustomizableLifecycleMapping - Action: execute


So here is my question :

* do I even need to create a plugin for that ?

* if so, why did I do wrong in the plugin code / binding ?


Thanks a lot in advance for your answers !

Anthony





Back to the top