hibernate3-maven-plugin fails with Java 1.7

Tuesday, January 24, 2012 12:05:32 AM

If you’re using Maven’s hibernate3-maven-plugin for creating a DDL file from your entities, you might encounter the following error when using Java 1.7:

Execution default of goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl failed:
An AnnotationConfiguration instance is required 

The reason seems to be a broken JRE detection in the Mojo code, which mistakenly assumes that Java 1.7 does not support annotations. However, I haven’t checked that in depth.

The fix is pretty easy. In the plugin configuration of the hibernate3-maven-plugin, add an implementation property to the componentProperties like this:


This enforces the use of an AnnotationConfiguration instance.

Written by Shred in Java

Tags: Hibernate, Java 1.7, Maven