Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Eclipse M2E在导入现有maven项目时未将Groovy源代码添加到.classpath_Eclipse_Maven_Groovy_M2e - Fatal编程技术网

Eclipse M2E在导入现有maven项目时未将Groovy源代码添加到.classpath

Eclipse M2E在导入现有maven项目时未将Groovy源代码添加到.classpath,eclipse,maven,groovy,m2e,Eclipse,Maven,Groovy,M2e,使用EclipseIndigo导入现有的maven项目,生成的工作区项目在构建路径中不包括src/main/groovy或src/test/groovy。我还希望将groovy代码的output dir设置为target/testclasses 这是我向这个优秀的团队提出的第一个问题,所以我希望我能涵盖所有的基础 环境: 靛蓝蚀 m2e-Eclipse 1.2.0.20120903-1050 org.Eclipse.m2e.feature.feature.group Eclipse.org的M

使用EclipseIndigo导入现有的maven项目,生成的工作区项目在构建路径中不包括
src/main/groovy
src/test/groovy
。我还希望将groovy代码的output dir设置为
target/testclasses

这是我向这个优秀的团队提出的第一个问题,所以我希望我能涵盖所有的基础

环境:

  • 靛蓝蚀
  • m2e-Eclipse 1.2.0.20120903-1050 org.Eclipse.m2e.feature.feature.group Eclipse.org的Maven集成-m2e
  • 构建助手maven插件的m2e连接器0.15.0.201207090124 org.sonatype.m2e.buildhelper.feature.feature.group sonatype,Inc
  • APT M2E连接器0.0.1.3 de.joe.M2E.APT.feature.feature.group null
  • Groovy Eclipse Feature 2.5.2.xx-20110929-1800-e37 org.codehaus.Groovy.Eclipse.Feature.Feature.group codehaus.org
  • Groovy Eclipse M2E集成2.7.1.xx-20120921-2000-e37RELEASE org.codehaus.Groovy.m2eclipse.feature.group codehaus.org
  • Tycho项目配置器0.6.0.201207302152 org.sonatype.Tycho.m2e.feature.feature.group sonatype,Inc
该项目的My pom.xml为:

<?xml version="1.0" encoding="UTF-8"?>
<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>

<parent>
<groupId>com.jha.yhs</groupId>
<artifactId>fraud.server.parent</artifactId>
<version>201203.8.0-SNAPSHOT</version>
</parent>
<artifactId>ach-wire</artifactId>
  <dependencies>

  <dependency>
    <groupId>com.jha.yhs</groupId>
    <artifactId>aspects</artifactId>
    <version>${project.version}</version>
  </dependency>

    <dependency>
        <groupId>com.jha.yhs</groupId>
        <artifactId>database</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

  <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>r09</version>
  </dependency>

  <dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>1.7.6</version>
  </dependency>

  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.spockframework</groupId>
    <artifactId>spock-core</artifactId>
    <version>0.5-groovy-1.7</version>
    <scope>test</scope>
  </dependency>

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.3.155</version>
</dependency>


  <dependency>
    <groupId>org.dbunit</groupId>
    <artifactId>dbunit</artifactId>
    <version>2.4.8</version>
    <scope>test</scope>
  </dependency>

  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>3.0.5.RELEASE</version>
  </dependency>

<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>1.6.2</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <scope>test</scope>
    <version>1.6.1</version>
</dependency>
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
    <version>1.8.5</version>
    <scope>test</scope>
</dependency>
 </dependencies>
 <build>
  <plugins>

    <plugin>
      <groupId>org.codehaus.gmaven</groupId>
      <artifactId>gmaven-plugin</artifactId>
      <version>1.3</version>
    </plugin>

  </plugins>
</build>
</project>

4.0.0
com.jha.yhs
使用buildhelper应该可以解决这个问题。我已经尝试将build helper引用放入到项目pom.xml中,但没有改变行为。我还尝试使用maven eclipse插件来设置其他源文件夹,如下所述和所示

我们有四个子项目使用groovy,我希望不必为main添加groovy文件夹和输出文件夹,只要我们从SVN中提取新代码,就可以对每一个子项目进行测试。似乎M2E的import maven项目无法正常工作。maven->updateProject在这方面也是如此。我错过了什么


作为一种解决方法,m2e 1.2似乎不会像m2e 1.0那样覆盖.classpath和.project文件,因此我可以始终手动配置.classpath和.project文件,并将它们置于源代码管理中。

我正在使用Groovy在使用Maven开发的webapp中使用Groovy。但是我使用的是
groovyclipse编译器
。首先,我配置Maven编译器插件:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerId>groovy-eclipse-compiler</compilerId>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>${groovy-eclipse-compiler.version}</version>
                </dependency>
            </dependencies>
        </plugin>

org.apache.maven.plugins
maven编译器插件
2.5.1
1.6
1.6
groovy eclipse编译器
org.codehaus.groovy
groovy eclipse编译器
${groovy eclipse compiler.version}
然后,我配置源目录:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</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>

org.codehaus.mojo
构建助手maven插件
1.7
添加源
生成源
添加源
src/main/groovy
添加测试源
生成测试源
添加测试源
src/test/groovy

在那之后,我就可以将Groovy与Eclipse+m2e结合使用了(实际上,我使用的是带有Groovy插件的Springsource工具套件)。我有Groovy语法和自动完成功能(远非理想),我还可以使用Java中的Groovy类,反之亦然。

当您将所有gmaven和build helper配置下推到子项目中时会发生什么?
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</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>