I have a multi module Maven based web application project with a hibernate-annotations dependency that was failing to compile. I was getting the compilation error below:

[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
An exception has occurred in the compiler (1.6.0_22). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for org.hibernate.annotations.CacheConcurrencyStrategy not found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------

Changing the dependency scope from provided to compile fixed the issue, but that would add unnecessary jars in the EAR that are already provided by the server, causing classloading errors on JBoss.

It turns out maven-compiler-plugin 2.3.2 has a bug, switching to 2.1 solves the issue.

Other modules that depend on the module with hibernate-annotations dependency will also have to explicity add hibernate-annotation dependency as provided.


Generating an EAR project for enterprise application

I’m migrating a J2EE 1.3 application to JEE5, from Ant to Maven. I couldn’t find a simple archtype that would allow me create a simple and clean directory structure like the one below. All the existing ones add a lot on directories which frankly i failed to comprehend (maven newbie). Another solution would have been to create a parent project and create modules.

JEE5 project structure

I stumbled upon javaee5-maven-archetype which allowed me to create exactly what i was looking for. I have a simple project structure thats easy to build (and break, and fix). It has a some batteries included 😉 Download it, install into you local repo, you are good to go. See Usage

Tagged with:  
© 2011 - Pass me the Mic