6

Ever since I've installed the new m2e plugin for maven, my Groovy project no longer builds. I'm using the groovy-compiler-plugin as described here. I get the old "plugin execution not covered..." error for the maven-compiler-plugin. I've tried both execute and ignore for the goals "testCompile" and "compile" as described in the error.

I can't use GMaven due to some arcane compiler issues. I also am locked to Maven 2.2.1 due to my company's build process. The old m2eclipse plugin is gone, and the documentation for m2e is atrocious.

I am at my wits end with this. Nowhere else do I see this issue. I can't be the only one.

If I can't find a solution to this very soon, I'm either scrapping maven for some hacked Gradle implementation (though I can't use that either), or I'm moving over to NetBeans, which is not a winning proposition.

As requested, the pom snippet is below.

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.5</version>
      <executions>
        <execution>
          <id>add-source</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>add-source</goal>
          </goals>
          <configuration>
            <sources>
              <source>src/main/groovy</source>
            </sources> 
          </configuration>
        </execution>
        <execution>
          <id>add-test-source</id>
          <phase>generate-test-sources</phase>
          <goals>
            <goal>add-test-source</goal>
          </goals>
          <configuration>
            <sources>
              <source>src/test/groovy</source>
            </sources>
          </configuration>
        </execution>    
      </executions>
    </plugin>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.1</version>
      <configuration>
        <compilerId>groovy-eclipse-compiler</compilerId>
        <verbose>true</verbose>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-eclipse-batch</artifactId>
          <version>1.8.0-03</version>
        </dependency>        
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-eclipse-compiler</artifactId>
          <version>2.5.1</version>
          <exclusions>
            <exclusion>
              <groupId>org.codehaus.groovy</groupId>
              <artifactId>groovy-eclipse-batch</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>

  <pluginManagement>
    <plugins>
      <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
      <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-compiler-plugin</artifactId>
              <versionRange>[2.3.1,)</versionRange>
              <goals>
                    <goal>testCompile</goal>
                    <goal>compile</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute />
                </action>
              </pluginExecution>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.codehaus.groovy</groupId>
                  <artifactId>groovy-eclipse-compiler</artifactId>
                  <versionRange>[2.5.1,)</versionRange>
                  <goals>
                    <goal>testCompile</goal>
                    <goal>compile</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute />
                </action>
              </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>  
</build>
Spencer Kormos
  • 8,381
  • 3
  • 28
  • 45
  • 1
    Can you post your pom, or at least the section with the m2eclipse lifecycle mapping? – Matthew Farwell Sep 07 '11 at 06:40
  • 1
    The archived release of m2eclipse is at http://m2eclipse.sonatype.org/archived-releases.html – Raghuram Sep 07 '11 at 08:27
  • Posted the POM snippet. There might be a slight misspelling due to formatting, but the bulk of the content is correct. In the meantime I'm going to try the archived plugin. Thanks. – Spencer Kormos Sep 07 '11 at 16:36
  • @Spencer K I have provided an update now which is also required for the groovy maven integration to work. This is as per documentation at link -> http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+compiler+plugin+for+Maven – Abe Sep 07 '11 at 17:01

2 Answers2

8

First, you must install the correct configurator. I am assuming that you are using m2e version 1.0. If that is the case, then you must install the newer version of the Groovy-Eclipse configurator for m2e. At this update site:

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

(do not use the groovy-m2eclipse-new update site. It is outdated and will go away soon.)

I haven't done extensive testing for the configurator on Eclipse 3.6, but it should work. I do recommend that you upgrade to Eclipse Indigo because things will generally work better on Indigo.

Second, you need to fix your pom.xml. Remove the reference to the org.eclipse.m2e plugin.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • Initial results seem to be positive. I'm going to reinstall 3.7, and retry the steps. I'll mark this the solution if I can get it working straight out. Thanks for the help thus far. Hopefully you can publish this on a blog somewhere! – Spencer Kormos Sep 07 '11 at 22:07
  • Thanks Andrew this fixed everything, though a couple of notes: If using Indigo, you should use the e3.7 link: http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/ and *do not* install the "maven integration" option (i.e. v1.0.0). Last and certainly not least, you still need to use the "build-helper-maven-plugin" and install the m2e connector for it. – Spencer Kormos Sep 08 '11 at 03:07
  • That is right. I can update the wiki page to make things more explicit. http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+compiler+plugin+for+Maven – Andrew Eisenberg Sep 08 '11 at 03:24
1

Take a look at the following link I posted in groovy user group. Note, I used spring STS which is just a better eclipse. I am also pasting my pom for a test suite for your reference, please note the sourceincludes element carefully. I was also at my wits end trying to fix this, but it definitely works now. Also, please make sure that the maven in eclipse points to the same one you installed in your machine otherwise it can also cause issues.

[Update] Also install either of the following plugins depending on your eclipse version to provide Groovy - Maven integration http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse-new/ or http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse/

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.org</groupId>
<artifactId>test-suite</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>test-suite</name>
<url>http://maven.apache.org</url>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
    <repository>
        <id>jetlang.googlecode.com</id>
        <name>Jetlang Repository for Maven</name>
        <url>http://jetlang.googlecode.com/svn/repo/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
        <version>2.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-support</artifactId>
        <version>2.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>3.0.5.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jetlang</groupId>
        <artifactId>jetlang</artifactId>
        <version>0.2.5</version>
    </dependency>
    <!-- Database pool -->
    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>
    <!-- ORACLE database driver -->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc5</artifactId>
        <version>11.2.0.1.0</version>
    </dependency>
    <dependency>
        <groupId>jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>
    <!-- Groovy jar -->
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy</artifactId>
        <version>1.8.0</version>
        <type>jar</type>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
                <compilerArgument>nowarn</compilerArgument>
                <!--<verbose>true</verbose> -->
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>2.5.1-1</version>
                </dependency>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-batch</artifactId>
                    <version>1.8.0-03</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
                </additionalProjectnatures>
                <sourceIncludes>
                    <sourceInclude>**/*.groovy</sourceInclude>
                </sourceIncludes>
            </configuration>
        </plugin>
    </plugins>
</build>

Abe
  • 8,623
  • 10
  • 50
  • 74
  • Do not use the version at http://dist.codehaus.org/groovy/distributions/greclipse/groovy-m2eclipse-new/. It is outdated. Instead, use the one at the regular snapshot update site. – Andrew Eisenberg Sep 07 '11 at 18:36
  • Which version of the m2e plugin are you using? How do you get around the plugin errors associated with the new m2e plugin and the connectors? – Spencer Kormos Sep 07 '11 at 19:45
  • Andrew, can you provide the specific link? There are 4 doc sites, and none of them seem to be correct, or up-to-date. – Spencer Kormos Sep 07 '11 at 19:48
  • This is the page that has all of the information: http://docs.codehaus.org/display/GROOVY/Groovy-Eclipse+compiler+plugin+for+Maven – Andrew Eisenberg Sep 07 '11 at 22:34