Feb 04
Digg
Stumbleupon
Technorati
Delicious

Groovy & Wicket

Hi all,

given some requests I publish a classresolver for Wicket that enable groovy pages & components to be hot reloaded in development mode.
I suppose you have a project with maven and so let’s start…

  1. Get the “mighty” GrovvyClassResolver
  2. (fix up the package)
  3. Open the WebApplication class and do something like that (remember that I use maven & jetty for dev, If u have a different project structure change the path of the BASE_SRC constant pointing to your source dirs)
    1. 
      
      /**
      
       *
      
       * @author Byte-Code Srl 2004-2007
      
       */
      
      public class GroovierWebApplication extends WebApplication {
      
      
      
          public static final String BASE_SRC = "src/main/java/";
      
      
      
      
      
          protected void init() {
      
              initSpringContext();
      
      
      
      
      
              getResourceSettings().setThrowExceptionOnMissingResource(false);
      
      
      
              String configurationType = getConfigurationType();
      
              if (configurationType.equals(DEVELOPMENT)) {
      
                  getResourceSettings().addResourceFolder(BASE_SRC);
      
      
      
                  getApplicationSettings().setClassResolver(new GroovyClassResolver(BASE_SRC));
      
              }
      
          } }
  4. You’re done! Now you can develop in wicekt using groovy & hot reload pages and components.
  5. As a side note remember to create a production profile so when you deploy the war the groovy class are compiled and you won’t loose any performances!
  6. Ok, now you have to transfer some bucks to my account… or it won’t work! ;)

Ok, that’s all folks, if u have problem just drop me an email!

D


Author: admin

No Comments

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a comment