Eclipse Helios + maven m2e + Groovy ==失败

Spe*_*mos 6 eclipse groovy maven m2e

自从我为maven安装了新的m2e插件后,我的Groovy项目不再构建.我正在使用这里描述的groovy-compiler-plugin .我得到maven-compiler-plugin的旧"插件执行未涵盖..."错误.我已经尝试了执行和忽略目标"testCompile"和"编译",如错误中所述.

由于一些神秘的编译器问题,我无法使用GMaven.由于我公司的构建过程,我也被Maven 2.2.1锁定了.旧的m2eclipse插件已经不见了,m2e的文档非常糟糕.

我对此有所了解.我没有其他地方看到这个问题.我不可能是唯一一个.

如果我很快就找不到这个解决方案,我要么为了一些黑客Gradle实现而废弃maven(虽然我也不能使用它),或者我正在转向NetBeans,这不是一个成功的命题.

根据要求,pom片段在下面.

<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>
Run Code Online (Sandbox Code Playgroud)

And*_*erg 8

首先,您必须安装正确的配置程序.我假设您使用m2e版本1.0.如果是这种情况,则必须为m2e安装较新版本的Groovy-Eclipse配置程序.在此更新站点:

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

(不要使用groovy-m2eclipse-new更新站点.它已经过时,很快就会消失.)

我没有对Eclipse 3.6上的配置程序进行过广泛的测试,但它应该可以工作.我建议你升级到Eclipse Indigo,因为在Indigo上通常会有更好的效果.

其次,你需要修复你的pom.xml.删除对org.eclipse.m2e插件的引用.