Using Groovy Works you can develop your "Java" web application and avoid time consuming re-deployments and re-starts. Using Spring's support for dynamic re-compilation of scripted beans you can simply code, save, test in your browser. No need for costly recompilation, package, deploy, restart cycles.
Right now Groovy Works exists as a Struts 2 Plug-in, and an example application. Groovy Works depends on Spring 2.0.3.
Primarily because I conceptually see this going beyond just being a Struts 2 plug-in. Groovy, and all the dynamic scripting languages, seem to be changing the face of web development. My vision of Groovy Works is focused on eliminating the re-compile re-deploy cycle, and dramatically improving developer productivity. I remember the days of working in PHP, saving my file, and hitting reload in my browser.
Anyway, I tried coming up with some contraction of Groovy and Struts, and it really didn't quite work. Struts 2 is based off of WebWork 2, which is based on XWork 2. So, I knocked the Web off the beginning of WebWork, and put Groovy there, added an "s" on the end, and voila, Groovy Works. In the end it's just a name. Got a better one?
I thought of Groovy Struts, but seeing as this only works with Struts 2, Groovy Struts 2 just didn't have the right ring to it. Thus, Groovy Works.
Not really, at the moment. Currently Groovy Works is simply a method of using the Groovy language to develop an application using Struts 2 and Spring. It's just a Struts 2 plug-in and a methodology, with an example.
Save time. This was my primary motivation in getting all of the moving parts working together.
I'm in the middle of a large Struts 2 project, and recently moved it to Maven and started using the Jetty plugin. The beauty of being able to edit my JSP files and just hit re-load in my browser got me thinking. Then I started implementing my Struts 2 actions in Groovy. I did some more research and the idea of reloading the actions automatically came to light, along with Spring's support for scripted beans. So, I thought, "wouldn't it be nice to just start the servlet container and code, without the hassle of restarts?!?!"
Most likely. If your project is already using Spring 2 and Struts 2 then you should be able to start using the techniques of Groovy Works simply by adding Groovy, and the plug-in to your project and adopting its techniques. Groovy Works is really just a technique of using Groovy, Spring and Struts 2 together.
Download the plug-in and install it to your Maven repository.
Then download the sample application and try it out.
Edit src/main/groovy/groovyworks/MyServiceImpl.groovy and change the message, save the file. Now, reload your browser. You should see whatever you changed your message to on the page. No application restart. You can edit your service bean to your hearts content and just keep reloading. (You do need to run 'mvn compile' after you save to copy the Groovy files to the target/classes directory. I'd like to eliminate that step though.) You can do the same thing with you action. You can also edit the JSP and just hit reload, thanks to Jetty.
It would be nice if the Maven Jetty Plugin could either be configured or modified to place the groovy files from the source tree into the classpath. (Update: I have this working using the testClassesDirectory setting for the Jetty plugin. It's kind of hackish, but really shows the potential.) It would also be nice if Jetty could be taught to re-start when a compiled Java class changes, but just keep running when a scripted bean is changed.
The plugin itself needs to be optimized to only recompile the Groovy actions when they change. Right now I believe it is doing it every time. (This is a proof of concept.)
Then there is the issue of boot strapping an application, much like Grails does. This isn't as important to me. I already have a lot of Struts 2 actions in Groovy, and my service and data layers are largely laid out. These features would be nice for new projects though.
I would think you can. If you are integrating with Spring already you just need to intercept the call to create a bean and see if it is a Groovy script. Take a look at the code in the plug-in for ideas.
Eventually I would like to eliminate the plug-in and just have Spring instantiate the action beans, but there are some issues with that right now.
I would like to thank a few people/groups for all they have done to support Java development: