Tonight I’ve fought with making Maven and Hibernate to cooperate… After 1,5h struggle, I’ve decided to write down what I’ve “discovered”.

  • When adding dependencies to your persist module you should avoid adding the hibernate package dependency itself as there should be only hibernate-annotations one.
  • When adding log4j dependency remember that version 1.2.15 is messed up and forces you to download jars from SUN webpages if you want to get rid of those nasty dependency errors that maven throw in your face… Instead of 1.2.15 choose 1.2.14 as it’s dependencies are not optional and Maven will successfully download all of them.
  • When adding slf4j (Simple Logging Factory For Java) remember that when you add slf4j-log4j12 package it comes with depended package slf4j-api but the versions might (and are!) non-compatible… In my case slf4j-log4j12 v. 1.5.6 came with slf4j-api v. 1.4.2. You should exclude slf4j-api dependency from slf4j-log4j12 and add it separately in the same version as slf4j-log4j12 (in this case 1.5.6).