You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by garbandi <ga...@yahoo.de> on 2007/01/03 12:35:14 UTC

using hibernate3-maven-plugin:hmb2ddl with test-classes

hi,

how can i set up hibernate3-maven-plugin (i'm using snapshot 1.0) to let
hmb2ddl scan classes from target/test-classes for annotations?

some backgroundinfo: i'm trying to set up a jar-project that uses
hibernate-annotations. it contains base-classes that use the
@MappedSuperclass. i want to write some unittest for this project that
contain the @Entity-classes. But if i use the hbm2ddl-goal it won't scan for
annotations that are part of the src/test-area.

so is there a way to add target/test-classes into the classpath that hbm2ddl
scans?

thanks in advance,
andi
-- 
View this message in context: http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-classes-tf2912961s177.html#a8139189
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: using hibernate3-maven-plugin:hmb2ddl with test-classes

Posted by Johann Reyes <jr...@hiberforum.org>.
Hello Andi

Well you just found a bug. I fixed already in SVN and deployed a new
snapshot. Try it out and let me know how it works

Regards

Johann Reyes

-----Original Message-----
From: garbandi [mailto:garbandi66-list@yahoo.de] 
Sent: Friday, January 05, 2007 8:02 AM
To: users@maven.apache.org
Subject: RE: using hibernate3-maven-plugin:hmb2ddl with test-classes


hi johann,

thanks for your help. adding the flag to the properties leads to various
lines of output

[INFO] found EJB3 Entity bean: XXX

where XXX now contains the classes in the test-classes directory

but then i receive a new ClassNotFoundException for those classes:

Caused by: java.lang.ClassNotFoundException: XXX
        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.j
ava:195)
        at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:
255)
        at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:
274)
        at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:
274)
        at
org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:21
4)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at
org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:112)
        at
org.codehaus.mojo.hibernate3.configuration.AnnotationComponentConfiguration.
classForName(AnnotationComponentConfiguration.java:204)
        at
org.codehaus.mojo.hibernate3.configuration.AnnotationComponentConfiguration.
addNamedAnnotatedClasses(AnnotationComponentConfiguration.java:175)
        ... 22 more

when i move the testclasses back to the src-area everything works.

seems that the classloader doesn't contain the test-classes, although you
find them.

any idea?

regards,
andi


Johann Reyes-2 wrote:
> 
> Hello Andi
> 
> Sorry, but I haven't document yet that part of the plugin because it's
> being
> tested. To scan the test-classes directory you need to add the following
> flag to your <componentProperties> element:
> 
> <componentProperties>
>   <scan-classes>true</scan-classes>
> </componentProperties>
> 
> Let me know if you have any question
> 
> Regards
> 
> Johann Reyes
> 
> 

-- 
View this message in context:
http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-clas
ses-tf2912961s177.html#a8177566
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: using hibernate3-maven-plugin:hmb2ddl with test-classes

Posted by garbandi <ga...@yahoo.de>.
hi johann,

thanks for your help. adding the flag to the properties leads to various
lines of output

[INFO] found EJB3 Entity bean: XXX

where XXX now contains the classes in the test-classes directory

but then i receive a new ClassNotFoundException for those classes:

Caused by: java.lang.ClassNotFoundException: XXX
        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.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
        at
org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at
org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:112)
        at
org.codehaus.mojo.hibernate3.configuration.AnnotationComponentConfiguration.classForName(AnnotationComponentConfiguration.java:204)
        at
org.codehaus.mojo.hibernate3.configuration.AnnotationComponentConfiguration.addNamedAnnotatedClasses(AnnotationComponentConfiguration.java:175)
        ... 22 more

when i move the testclasses back to the src-area everything works.

seems that the classloader doesn't contain the test-classes, although you
find them.

any idea?

regards,
andi


Johann Reyes-2 wrote:
> 
> Hello Andi
> 
> Sorry, but I haven't document yet that part of the plugin because it's
> being
> tested. To scan the test-classes directory you need to add the following
> flag to your <componentProperties> element:
> 
> <componentProperties>
>   <scan-classes>true</scan-classes>
> </componentProperties>
> 
> Let me know if you have any question
> 
> Regards
> 
> Johann Reyes
> 
> 

-- 
View this message in context: http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-classes-tf2912961s177.html#a8177566
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: using hibernate3-maven-plugin:hmb2ddl with test-classes

Posted by Johann Reyes <jr...@hiberforum.org>.
Hello Andi

Sorry, but I haven't document yet that part of the plugin because it's being
tested. To scan the test-classes directory you need to add the following
flag to your <componentProperties> element:

<componentProperties>
  <scan-classes>true</scan-classes>
</componentProperties>

Let me know if you have any question

Regards

Johann Reyes

-----Original Message-----
From: garbandi [mailto:garbandi66-list@yahoo.de] 
Sent: Thursday, January 04, 2007 11:53 AM
To: users@maven.apache.org
Subject: RE: using hibernate3-maven-plugin:hmb2ddl with test-classes


hi johann,

i've moved to 2.0. but i didn't find myself a way to scan the classes in
test-classes. so i would appreciate your help.

best regards,
andi


Johann Reyes-2 wrote:
> 
> Hello Andi
> 
> I believe that with version 1.0-SNAPSHOT you can not scan the
> test-classes,
> but 2.0-SNAPSHOT can do. Would you be willing to use the 2.0-SNAPSHOT? I
> can
> help you to configure again your plugin if that is the case.
> 
> Regards
> 
> Johann Reyes
> 

-- 
View this message in context:
http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-clas
ses-tf2912961s177.html#a8162664
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: using hibernate3-maven-plugin:hmb2ddl with test-classes

Posted by garbandi <ga...@yahoo.de>.
hi johann,

i've moved to 2.0. but i didn't find myself a way to scan the classes in
test-classes. so i would appreciate your help.

best regards,
andi


Johann Reyes-2 wrote:
> 
> Hello Andi
> 
> I believe that with version 1.0-SNAPSHOT you can not scan the
> test-classes,
> but 2.0-SNAPSHOT can do. Would you be willing to use the 2.0-SNAPSHOT? I
> can
> help you to configure again your plugin if that is the case.
> 
> Regards
> 
> Johann Reyes
> 

-- 
View this message in context: http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-classes-tf2912961s177.html#a8162664
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: using hibernate3-maven-plugin:hmb2ddl with test-classes

Posted by Johann Reyes <jr...@hiberforum.org>.
Hello Andi

I believe that with version 1.0-SNAPSHOT you can not scan the test-classes,
but 2.0-SNAPSHOT can do. Would you be willing to use the 2.0-SNAPSHOT? I can
help you to configure again your plugin if that is the case.

Regards

Johann Reyes

-----Original Message-----
From: garbandi [mailto:garbandi66-list@yahoo.de] 
Sent: Wednesday, January 03, 2007 6:35 AM
To: users@maven.apache.org
Subject: using hibernate3-maven-plugin:hmb2ddl with test-classes


hi,

how can i set up hibernate3-maven-plugin (i'm using snapshot 1.0) to let
hmb2ddl scan classes from target/test-classes for annotations?

some backgroundinfo: i'm trying to set up a jar-project that uses
hibernate-annotations. it contains base-classes that use the
@MappedSuperclass. i want to write some unittest for this project that
contain the @Entity-classes. But if i use the hbm2ddl-goal it won't scan for
annotations that are part of the src/test-area.

so is there a way to add target/test-classes into the classpath that hbm2ddl
scans?

thanks in advance,
andi
-- 
View this message in context:
http://www.nabble.com/using-hibernate3-maven-plugin%3Ahmb2ddl-with-test-clas
ses-tf2912961s177.html#a8139189
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org