12.3. Deployment
Deploying Groovy classes works like deploying Java classes. As with JavaBeans component classes, Seam can redeploy GroovyBeans component classes without restarting the application.
12.3.1. Deploying Groovy code
Groovy entities, session beans, and components all require compilation to deploy — use the
groovyc ant task. Once compiled, a Groovy class is identical to a Java class, and the application server will treat them equally. This allows a seamless mix of Groovy and Java code.
12.3.2. Native .groovy file deployment at development time
Seam supports
.groovy file hot deployment (deployment without compilation) in incremental hot deployment mode. This mode is development-only, and enables a fast edit/test cycle. Follow the configuration instructions at Section 5.8, “Seam and incremental hot deployment” to set up .groovy hot deployment. Deploy your Groovy code (.groovy files) into the WEB-INF/dev directory. The GroovyBean components will deploy incrementally, without needing to restart either application or application server.
Note
The native
.groovy file deployment has the same limitations as the regular Seam hot deployment:
- components must be either JavaBeans or GroovyBeans — they cannot be EJB3 beans.
- entities cannot be hot deployed.
- hot-deployable components are not visible to any classes deployed outside
WEB-INF/dev. - Seam debug mode must be enabled.
12.3.3. seam-gen
Seam-gen transparently supports Groovy file deployment and compilation. This includes the native
.groovy file hot deployment available during development. In WAR-type projects, Java and Groovy classes in src/hot are automatic candidates for incremental hot deployment. In production mode, Groovy files will be compiled prior to deployment.
There is a Booking demonstration, written completely in Groovy and supporting incremental hot deployment, in
examples/groovybooking.
Important
The groovybooking example uses
maven-antrun-plugin, which JBDS cannot import automatically. As a result, the example cannot be built automatically in JBDS. To build the example, use Maven (mvn clean package).