Message-ID: <402360805.780382.1386356413822.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_780381_912937802.1386356413822" ------=_Part_780381_912937802.1386356413822 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
There are several approaches to compiling Groovy code in your Ma= ven projects. GMaven is the most flexible and feature rich, but it has = some difficulties with joint Java-Groovy projects and it is no longer under= active development. The Groovy-Eclipse compiler plugin for Maven sidesteps t= he joint compilation issues. Read this page for a deeper discussion of the be= nefits and disadvantages of the two approaches.=20
A third approach is to use Maven's Ant plugin to compile a groovy projec= t. Note that the Ant plugin is bound to the compile and test-compile phases= of the build in the example below. It will be invoked during these phases = and the contained tasks will be carried out which runs the Groovy compiler = over the source and test directories. The resulting Java classes will coexi= st with and be treated like any standard Java classes compiled from Java so= urce and will appear no different to the JRE, or the JUnit runtime.=20 =20
This assumes you have a Maven project setup with "groovy" subf= olders as peers to the java src and test subfolders. You can use the java/j= ar archetype to set this up then rename the java folders to groovy or keep = the java folders and just create groovy peer folders. There exists, also a = groovy plugin which has not been tested or used in production. After defini= ng the build section as in the above example, you can invoke the typical Ma= ven build phases normally. For example, "mvn test" will execute t= he test phase, compiling Groovy source and Groovy test source and finally e= xecuting the unit tests. If you run "mvn jar" it will execute the= jar phase bundling up all of your compiled production classes into a jar a= fter all of the unit tests pass. For more detail on Maven build phases cons= ult the Maven2 documentation.