bean generation

0 views
Skip to first unread message

flefevre

unread,
Jun 29, 2007, 5:37:18 AM6/29/07
to gwt-maven
Hello,

this project is very nice.
i would like to generate bean from a jar : is it possible, if yes how?

I have another maven project with many beans, that are packaged in a
jar.
How can I tell to gwt plugin to generate the cleint beans?

I have to set:
# generatorRootClasses : A comma separated list of root classes to
traverse creating IsSerializable beans.
# generatorDestinationPackage: The package generated beans should go
into.

So i have putted:

<generatorRootClasses>fr.cns.genoscope.nemo.studio.cbm</
generatorRootClasses>

<generatorDestinationPackage>fr.cea.nemo.nstudio.client</
generatorDestinationPackage>
<generateGettersAndSetters>true</
generateGettersAndSetters>
</configuration>

But I get an error:
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception
running Generator
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
559)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:
488)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
458)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:
306)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:
273)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:589)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception
running Generator
at
com.totsp.mavenplugin.gwt.BeanGeneratorMojo.execute(BeanGeneratorMojo.java:
62)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
412)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
534)
... 16 more
Caused by: java.lang.ClassNotFoundException:
fr.cns.genoscope.nemo.studio.cbm
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:
195)
at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:
255)
at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:
274)
at
org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:
214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
com.totsp.mavenplugin.gwt.BeanGeneratorMojo.execute(BeanGeneratorMojo.java:
55)
... 18 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Jun 29 11:36:23 CEST 2007
[INFO] Final Memory: 4M/508M
[INFO]
------------------------------------------------------------------------

Where I am wrong?
Thanks for your help.

Francois

Will Pugh

unread,
Jul 3, 2007, 1:42:44 PM7/3/07
to gwt-...@googlegroups.com
Hmm.

This should work fine, as long as your Jar is listed as a dependancy
in your POM. The GenerateBeans task will resolve up to compile
dependencies, and gets the class information via reflection (after
doing a bit of classloader setup).

I do this on one of my projects, so I would make sure your POM has the
dependency set up correctly.

One note, the BeanGenerator will need to be able to load the class at
generation time (via loadClass). This should call any static
constructor, etc that you have. If these fail, you will probably get
some form of funny error saying either the Class could not be loaded
or it could not be found.

For Beans, I would hope there is not much in the way of complicated
static constructors or dependencies, but this is a problem that could
possibly occur.

--Will

Reply all
Reply to author
Forward
0 new messages