0 Replies Latest reply on Jun 19, 2008 4:59 PM by Josh Juneau

    Using Groovy with Seam in Netbeans 6.1

    Josh Juneau Newbie

      Of course, Seam 2.0 is ready to go with Groovy support which is great news!  However, for someone who is not interested in using Seam Gen it is not very straight forward.  This is true especially if one wishes to use Eclipse or Netbeans for their development environment. 

      A while back, I wrote a blog about developing Seam applications on Netbeans and deploying to Glassfish (http://jj-blogger.blogspot.com/2007/07/jboss-seam-configurations-jars-and.html).  I need to post an update blog because I am now deploying Seam 2.0 apps to Glassfish Version 2 using Netbeans.  I'd like to add a bit of syntactic candy into the process now and include Groovy support into my Netbeans Seam projects.

      Simply add the following to your build.xml file (contained within the root of your Netbeans project) and modify paths accordingly.  You will also need to package groovy-all.jar with your application.  Once completed, you can add Groovy files suffixed with .groovy into your project Seamlessly.  At compile time, they will be compiled into Java classes.

      (inside build.xml file)

      <target name="-pre-compile">
              <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${libs.Seam2.0.0.classpath}" />
          <groovyc destdir="${classes.dir}"
                 jointcompilationoptions="-j -Jsource=1.5 -Jtarget=1.5">
            <src path="${src.dir}"/>

      This solution has been tested using Netbeans 6.1, Groovy 1.5.1, Seam 2.0.0, and Glassfish V2.