Archive

Posts Tagged ‘asm’

Hibernate 3.2.x and Groovy – ASM madness

No Gravatar

I was playing a bit with Hibernate and Groovy. I was about to examine the possibility of using Groovy producing JPA Entities.

As I use Maven 2, the natural way is to create a project and define dependencies. As a good Maven user I was looking for the best artifact in the maven repository. I found Hibernate, and Groovy too. I took the latest from both. For groovy there was a choice between groovy-all and groovy. The groovy POM file was more descriptive, so I took that one.

Now that was a bad idea.

The problem is: Hibernate depends on ASM 1.5.3 while Groovy depends on ASM 2.2. ASM is not backward compatible, so ASM 2.2 won’t work for Hibernate. It will fail with class not found exception, (and vice versa for Groovy). After a day of hacking Maven POM file, and looking for some solution, I found this. Just look at the last paragraph, there is the solution. Just pick groovy-all. So I did that, and everything is fine again. Or at least to thought so…
I work on a framework, so I need to use ASM to enhance or to create some code at runtime. I usually do that by using ASM Eclipse plugin, because that is the fastest and easiest path. But that plugin relies on ASM 2.2, and now I’m back where I was… :-(

Ok, I could use a class loader hierarchy, but that would mean special configuration for Maven, or even worst, special configuration at deployment.

I think the Hibernate team should consider the solution Groovy team made.

Or I’m going to do that. :-)

Nice and easy.

Share