Maven compile mixed Java + Groovy 1.7 project, using gmaven-plugin

前端 未结 3 462
既然无缘
既然无缘 2020-12-05 04:39

As per the top two answers in: maven dependencies groovy. I\'m trying to compile a mixed Java 6 + Groovy project with Maven, using the GMaven-plugin from org.codehaus.gmaven

相关标签:
3条回答
  • 2020-12-05 05:06
    <plugins>
    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                        <compilerId>groovy-eclipse-compiler</compilerId>                    
                    </configuration>
    <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>2.8.0-01</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>2.1.5-03</version>
          </dependency>
    </dependencies>             
                </plugin>   </plugins>
    

    See this article, it helped me to compile both java and groovy

    Groovy Java compile together

    0 讨论(0)
  • 2020-12-05 05:11

    That works for me as well with one small addition:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
    

    Maybe there is a way to make this the default?

    0 讨论(0)
  • 2020-12-05 05:17

    I had the same problem. I was missing the providerSelection configuration setting for 1.7.

    Try this configuration and it should work for you.

      <plugin>
          <groupId>org.codehaus.gmaven</groupId>
          <artifactId>gmaven-plugin</artifactId>
          <version>1.2</version>
          <configuration> 
            <providerSelection>1.7</providerSelection> 
          </configuration> 
          <dependencies>
              <dependency>
                <groupId>org.codehaus.gmaven.runtime</groupId>
                <artifactId>gmaven-runtime-1.7</artifactId>
                <version>1.2</version>
                <exclusions>
                  <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                  </exclusion>
                </exclusions>
              </dependency>
              <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>1.7.0</version>
              </dependency>
          </dependencies>
          <executions>
              <execution>
                  <goals>
                      <goal>generateStubs</goal>
                      <goal>compile</goal>
                      <goal>generateTestStubs</goal>
                      <goal>testCompile</goal>
                  </goals>
              </execution>
          </executions>
      </plugin>
    
    0 讨论(0)
提交回复
热议问题