pom.xml:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>Instrument domain classes</id>
<configuration>
<tasks>
<taskdef name="instrument"
classname="org.hibernate.tool.instrument.cglib.InstrumentTask">
<classpath>
<path refid="maven.dependency.classpath"/>
<path refid="maven.plugin.classpath"/>
</classpath>
</taskdef>
<instrument verbose="true">
<fileset dir="${project.build.outputDirectory}">
<include name="**/model/*.class"/>
</fileset>
</instrument>
</tasks>
</configuration>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
</dependency>
</dependencies>
</plugin>
I recommend using the javassist version instead; it gave me less problems:
ReplyDeleteorg.hibernate.tool.instrument.javassist.InstrumentTask
Nice! Simple. Works.
ReplyDeleteClass "org.hibernate.tool.instrument.cglib.InstrumentTask" is deprecated (see http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/tool/instrument/cglib/InstrumentTask.html)
ReplyDeleteUse "org.hibernate.tool.instrument.javassist.InstrumentTask" instead.