Groovy-Eclipse compiler plugin for Maven
阿新 • • 發佈:2019-01-27
How to use the compiler plugin---Setting up the POM
In your plugin section, you must change the compiler used by the
maven-compiler-plugin. Like the
javac ant task, the maven-compiler-plugin does not actually compile, but rather delegates the compilation to a different artifact (in our case, the
groovy-eclipse-batch
t;build>
...
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.6 .0-01</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
</build>
By default, this will use Groovy 1.8.4 to compile your code. If you would prefer to use 1.7.10, then add another dependency to the maven-compiler-plugin:
t;dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-eclipse-batch</artifactId> <version>1.7.10-06</version> </dependency>
This will allow Groovy files to be compiled. The groovy-eclipse-compiler recognizes all settings supported by the maven-compiler-plugin.
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.