Wiki source code of Groovy in Java EE with Maven
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | It is quite easy to add Groovy support. Once the support is in place you can use Groovy as you would use regular Java. As a matter of fact to test out Groovy we will create a Struts2 action with it! | ||
2 | |||
3 | |||
4 | Following assumes we have set up a basic struts2 application using Maven: | ||
5 | |||
6 | 1) In Netbeans, expand the "Project Files" and open pom.xml. | ||
7 | |||
8 | 2a) Locate the maven compiler plugin, which in my poms typically looks like the following: | ||
9 | |||
10 | |||
11 | <plugin> | ||
12 | <groupId>org.apache.maven.plugins</groupId> | ||
13 | <artifactId>maven-compiler-plugin</artifactId> | ||
14 | <version>2.3.2</version> | ||
15 | <configuration> | ||
16 | <source>1.7</source> | ||
17 | <target>1.7</target> | ||
18 | <compilerArguments> | ||
19 | <endorseddirs>${endorsed.dir}</endorseddirs> | ||
20 | </compilerArguments> | ||
21 | </configuration> | ||
22 | </plugin> | ||
23 | |||
24 | |||
25 | 2b) Edit this pom.xml such that the above looks like the following: | ||
26 | |||
27 | <plugin> | ||
28 | <groupId>org.apache.maven.plugins</groupId> | ||
29 | <artifactId>maven-compiler-plugin</artifactId> | ||
30 | <version>2.3.2</version> | ||
31 | <configuration> | ||
32 | **~ <compilerId>groovy-eclipse-compiler</compilerId>** | ||
33 | **~ <verbose>true</verbose>** | ||
34 | <source>1.7</source> | ||
35 | <target>1.7</target> | ||
36 | </configuration> | ||
37 | **~ <dependencies>** | ||
38 | **~ <dependency>** | ||
39 | **~ <groupId>org.codehaus.groovy</groupId>** | ||
40 | **~ <artifactId>groovy-eclipse-compiler</artifactId>** | ||
41 | **~ <version>2.6.0-01</version>** | ||
42 | **~ </dependency>** | ||
43 | **~ </dependencies>** | ||
44 | </plugin> |