Maven 2.0.8 not working with Spring 2.5.6 and JUnit 4.4

A few days ago, I ran into a strange bug when I was running JUnit4 test. Compiling of the JUnit test package went smoothly with Maven, but the Spring beans were not initialized properly in running time, and kept being null.  The version of my Spring is 2.5.6 and JUnit library is 4.4, all up to date. At the beginning, I suspected that it was a Spring configuration issue and spent lots of time playing with all sorts of bean autowire options, but in the end, I found that if I just simply upgraded Maven from 2.0.8 to the latest 2.2.1 version, everything worked correctly. So the moral of the story is that I need to keep all packages up to date and don’t miss any single one.

Leave a Reply