Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-dev] Lifecycle Mapping / Secondary Configurator issue

Hi,

I've been trying to create, for fun, an archetype generating eclipse plugins written in groovy, built with Tycho (https://github.com/open-archetypes/groovy-eclipse-plugin-archetype) *

Groovy compiler support is added via : 

        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-plugin</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>2.7.0-01</version>
                </dependency>
            </dependencies>
        </plugin>

It works fine so far in command line builds. For the IDE, I'm using a combination of the Groovy/Grails Tool Suite, m2e and m2eclipse-tycho.

I noticed the Groovy Nature is not added to the generated core project, so I looked at the lifecycle-mapping-metadata.xml in org.codehaus.groovy.m2eclipse configurator and tried to add a new lifecycle mapping (LM) entry (similar to  https://github.com/jbosstools/m2e-jdt-compiler/blob/master/org.jboss.tools.m2e.jdt.core/lifecycle-mapping-metadata.xml ) :

<pluginExecution>
<pluginExecutionFilter>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<versionRange>[0.14.0,)</versionRange>
<parameters>
<compilerId>groovy-eclipse-compiler</compilerId>
</parameters>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<configurator>
<id>org.codehaus.groovy.m2eclipse.configurator</id>
</configurator>
</action>
</pluginExecution>

But turns out, m2e doesn't like it and I face a "Conflicting lifecycle mapping error" accompanied by the dreaded "plugin execution not covered", when testing that LM  :

Conflicting lifecycle mapping (plugin execution "org.eclipse.tycho:tycho-compiler-plugin:0.15.0:compile (execution: default-compile, phase: compile)"). To enable full functionality, remove the conflicting mapping and run Maven->Update Project Configuration.

Actually m2eclipse-tycho defines the following pluginExecution for tycho-compiler-plugin :

    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-compiler-plugin</artifactId>
        <versionRange>[0.12.0,)</versionRange>
        <goals>
          <goal>compile</goal>
          <goal>testCompile</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>

Actual tycho-compiler-plugin settings are handled via  <lifecycleMappingId>org.sonatype.tycho.m2e.tychoLifecycleMapping</lifecycleMappingId>

The real issue is there's no notion of secondary lifecycleMapping we could extend and there's no way to use a secondary configurator for a principal pluginExecution mapping using <ignore> (or <execute>). The lifecycle mapping part of m2e being a bit sensible, I'd like to hear some advice before I start breaking things.

Until a proper solution is implemented in m2e core, I was thinking m2eclipse-tycho could be modified to use an IgnoreConfigurator, that could then have a secondary configurator defined in org.codehaus.groovy.m2eclipse.

Ideas anyone? 

Regards,

Fred Bricon

* Before you ask, I like Groovy a lot, but I suck at it, never really had a chance to actually do something more meaningful than a hello world example, so don't pay attention to the 'groovy' code in the archetype. Feel free to fork the it and enhance it at your will :-P

-- 
"Have you tried turning it off and on again" - The IT Crowd

Back to the top