Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

The most recent version of the Groovy-Eclipse-Compiler plugin for maven is 2.78.10-01.
2.89.0-01-SNAPSHOT is now available from http://nexus.codehaus.org/snapshots/.

The most recent version of the groovy-eclipse-batch artifact is 2.1.35-01 03 (for Groovy 2.1) and 2.0.7-01 03 (for Groovy 2.0). They are both available from maven central.

 

...

Code Block
languagehtml/xml
<build>
...
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2<<!-- 2.8.0-01 and later require maven-compiler-plugin 3.0 or higher -->
    <version>3.0</version>
    <configuration>
      <compilerId>groovy-eclipse-compiler</compilerId>
      <!-- set verbose to be true if you want lots of uninteresting messages -->
      <!-- <verbose>true</verbose> -->
    </configuration>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-eclipse-compiler</artifactId>
        <version>2.78.0-01</version>
      </dependency>
    </dependencies>   </plugin>!-- for  2.8..
</plugins>
</build>

By default, this will use Groovy 2.0.4 to compile your code. If you would prefer to use 1.8.6 or 1.7.10, then add another dependency to the maven-compiler-plugin:

Code Block
languagehtml/xml
<dependency>
  0-01 and later you must have an explicit dependency on groovy-eclipse-batch -->
      <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-eclipse-batch</artifactId>
        <version>2.1.5-03</version>
        <!-- or choose a different compiler version -->
        <!-- <version>1.8.6-01</version> -->
        <!-- <version>1.7.10-06</version> -->
</dependency>
 </dependencies>
  </plugin>
  ...
</plugins>
</build>

This will allow Groovy files to be compiled. The groovy-eclipse-compiler recognizes all settings supported by the maven-compiler-plugin.

...

Code Block
languagehtml/xml
<dependencies>
  ...
  <dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>1.8.6</version>
  </dependency>
  ...
</dependencies>

 

 

Note that the groovy-eclipse-compiler and groovy-eclipse-batch artifacts are available in Maven-central, so there is no need to explicitly declare any extra repositories.

...

Code Block
languagehtml/xml
<build>
  ...
  <plugin>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-eclipse-compiler</artifactId>
    <version>2.78.0-01</version>
    <extensions>true</extensions>
  </plugin>
  ...
</build>

...

Code Block
languagebash
mvn archetype:generate \
    -DarchetypeGroupId=org.codehaus.groovy \
    -DarchetypeArtifactId=groovy-eclipse-quickstart \
    -DarchetypeVersion=2.5.2-01 \
    -DgroupId=foo \
    -DartifactId=bar \
    -Dversion=1 \
    -DinteractiveMode=false \
    -DarchetypeRepository=https://nexus.codehaus.org/content/repositories/snapshots/

(This archetype is not actively maintained.)

A sample project using the compiler plugin as well as the source code for the plugin itself are available from the github repository:

...