Maven is kind of everywhere in the Java build world, but nonetheless it annoys me to no end. I've been using Ant for many years now, but never really found a good use for Maven since it never really fit with my needs since most of the projects I worked on in the past were in a mixture of C, Python and other languages. In that space I never found much need to the dependency handling capabilities that Maven brings to the table.
At my new job though... we have some Java code... and it uses Maven.
This afternoon (and into the late evening) I spent fighting with Maven doing something that made no sense. I had been working happily along on a project when all of a sudden it stopped compiling with the following error:
Failure executing javac, but could not parse the error: An exception has occurred in the compiler (1.6.0_31). 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
This is pretty strange since the project doesn't use hibernate (at least not for the part I'm working on) and it was compiling fine 10 minutes ago and there haven't been any updates to the SCM repository. So what the hell is going on here. Ultimately I ended up having to add some dependencies and a repository for getting the missing Hibernate libraries. But I still don't understand what went wrong in the first place. And weirder still... it continued to compile for one of my coworkers throughout this period. Very very strange indeed.
If you run into this problem... the quick solution is to update your pom.xml with the following hunks:
<dependencies> ... <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.6.0.Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.5.6-Final</version> </dependency> ... </dependencies> <repositories> ... <repository> <id>repository.jboss.org</id> <name>JBoss Maven Repository</name> <url>https://repository.jboss.org/nexus/content/groups/public/</url> <layout>default</layout> </repository> ... </repositories>
And while I'm talking about it... what the hell is up with those version numbers for the hibernate dependencies... Once is #.#.#.Final and the other is #.#.#-Final. Why?!