Eclipse Helios + maven m2e + Groovy == FAIL [英] Eclipse Helios + maven m2e + Groovy == FAIL

查看:162
本文介绍了Eclipse Helios + maven m2e + Groovy == FAIL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我为maven安装了新的m2e插件之后,我的Groovy项目就不再生成了。我正在使用groovy-compiler-plugin,如 here 所述。我得到了maven-compiler-plugin的旧的插件执行不覆盖...错误。我已经尝试执行和忽略目标testCompile和编译,如错误所述。



我不能使用GMaven由于一些奥秘编译器的问题。由于我公司的构建过程,我也被锁定到Maven 2.2.1。旧的m2eclipse插件已经过去了,而m2e的文档是残酷的。



我用这个我的智慧结束了。我没有其他地方看到这个问题。我不能成为唯一的一个。



如果我很快找不到一个解决方案,我要么为了一些被砍死的Gradle实现,我也不能使用它,或者我转移到NetBeans,这不是一个获胜的命题。



根据请求,pom代码片段在下面。 / p>

 < build> 
< plugins>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> build-helper-maven-plugin< / artifactId>
< version> 1.5< / version>
<执行>
< 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>
<依赖关系>
<依赖关系>
< groupId> org.codehaus.groovy< / groupId>
< artifactId> groovy-eclipse-batch< / artifactId>
< version> 1.8.0-03< / version>
< / dependency>
<依赖关系>
< groupId> org.codehaus.groovy< / groupId>
< artifactId> groovy-eclipse-compiler< / artifactId>
< version> 2.5.1< / version>
<排除>
< exclude>
< groupId> org.codehaus.groovy< / groupId>
< artifactId> groovy-eclipse-batch< / artifactId>
< / exclusion>
< / exclusions>
< / dependency>
< / dependencies>
< / plugin>
< / plugins>

< pluginManagement>
< plugins>
<! - 此插件的配置仅用于存储Eclipse m2e设置。它对Maven构建本身没有影响.-->
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / 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>


解决方案

首先,您必须安装正确的配置器。我假设你使用的是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插件的引用。


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>

解决方案

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.

这篇关于Eclipse Helios + maven m2e + Groovy == FAIL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆