Bug in Maven Surefire Plugin
Posted by Martin Homik | Posted in Java, WebApp | Posted on 26-03-2008
0
On March 18 i tuned on my Laptop in the office ran a Maven build command on my project and it suddenly stopped with exceptions that pointed to Spring’s Beanfactory which was unable to load a bunch of beans. This was strange, because the evening before everything passed my JUnit tests. What happened?
I consulted AppFuse’s User group and found a thread which described my problem. Unfortunately, no good solution has been proposed. The author pointed to a Jira Issue in which a work around is described, but well, it’s not a good solution. A few other guys joined in the discussion, but none was able to solve the problem.
Today morning, I digged a bit deeper in it. I recalled March 18. One thing you have to know about Maven is, that by default, prior to compiling, it checks for new jar versions every day and downloads them. So I looked into my local m2 repository and found out that Maven downloaded the latest surefire plugin. I went to its web site and found a Jira bug report describing exactly the problem. However, the problem is still unresolved. But now that I know which version of the plugin caused the problem, I told my Maven project description not to use it and to use a previous version instead. Just add the follwing snippet to your build plugins section:
-
<plugin>
-
<groupId>org.apache.maven.plugins</groupId>
-
<artifactId>maven-surefire-plugin</artifactId>
-
<version>2.3</version>
-
</plugin>
Guess what, it solved my problem. And that makes my day.

