-
1. Re: Groovy doesn't seem Java classes?
idyoshin Dec 19, 2009 8:09 AM (in response to piotr.sobczyk)Verify the classpath of your groovy build.
it's seems to me that in seam-generated project firstly compiles groovy code. and then the java code. So if you're in the mixed-up environment where some model classes in java, and some in groovy... you should consider modify the compile part of the ant script...
-
2. Re: Groovy doesn't seem Java classes?
piotr.sobczyk Dec 19, 2009 11:58 AM (in response to piotr.sobczyk)Thanks, Ilya.
The problem was definitely with ant script. In Seam 2.2.0 CR1 the corresponding fragment of war buildfile was:
<target name="groovy.compilemodel" if="groovy.present"> <!-- model is always compiled --> <classpathref="build.classpath" destdir="${classes.model.dir}" srcdir="${src.model.dir}" jointCompilationOptions="-j"> </groovyc> </target>
and in 2.2.0 GA there is:
<target name="groovy.compilemodel" if="groovy.present"> <!-- model is always compiled --> <groovyc classpathref="build.classpath" destdir="${classes.model.dir}" srcdir="${src.model.dir}" > </groovyc> </target>
Because of
jointCompilatinOptions="-j"
in 2.2.0CR1 java classes were joint compiled with groovy classes (i.e groovyc delegated compiling java classes to java and all classes were compiled in correct order). But as it is stated in groovyc task documentation:
Joint compilation is only available since 1.1-beta-2, jointCompilationOptions is no longer supported, use the nested javac insteadAnd that is why Seam developers probably removed this piece in 2.2.0. But I don't know why they didn't put nested javac instead so I had to do it manually:
<target name="groovy.compilemodel" if="groovy.present"> <!-- model is always compiled --> <groovyc classpathref="build.classpath" destdir="${classes.model.dir}" srcdir="${src.model.dir}"> <javac source="1.6" target="1.6"/> </groovyc> </target>
-
3. Re: Groovy doesn't seem Java classes?
piotr.sobczyk Dec 19, 2009 1:50 PM (in response to piotr.sobczyk)However now I've got a new strange problem. When I invoke target that include compiling classes (i.e) explode directly from ant then everything works allright but when I activate custom Eclipse builder that invokes my explode target on I'm getting such exception when target is invoked:
Buildfile: C:\Users\Piotrek\Desktop\Programowanie\workspaces\shopping_workspace\Shopping\build.xml init: groovy.compilemodel: BUILD FAILED C:\Users\Piotrek\Desktop\Programowanie\workspaces\shopping_workspace\Shopping\build.xml:144: groovyc doesn't support the "srcdir" attribute
It may seem that task is not defined properly but there is proper task definition in init target:
<taskdef name="groovyc" classname ="org.codehaus.groovy.ant.Groovyc" classpathref="build.classpath"/>
and as you may see above, init target is being invoked before groovy.compilemodel. As I mentioned on the beginning, manually invoking this target works great and with no exception wchich makes this situation very strange :(.
Anyone experienced such problem? Thanks in advance.