After running `mvn eclipse:eclipse` this morning, we got a warning from eclipse, telling us that “Build path specifies execution environment J2SE-1.5. There are no JREs in the workspace strictly compatible with this environment.” We didn’t make any changes that could cause this warning, though. We deceided to leave the problem as it was and fix it later – it’s only a warning anyway. However, when trying to start another project, I got another exception I haven’t ever received before. It was caused by mixing up wrong versions of different slf4j JARs.
I suddenly had the feeling that ther’s something fishy with the maven-eclipse-plugin. And in deed, a look into the ~/.m2/repository/org/apache/maven/plugins/maven-eclipse-plugin proved me right. There is a brand new version 2.6 of the plugin.
This new version automagically adds projects from the workspace rather than JARs from the local repository (which is cool, basically). However, that caused Eclipse to load the wrong JARs: One project depended on sl4j 1.3, another one on 1.5 and the other project. Maven perfectly resolves the version of this transient depenedency, while Eclipse picks one by chance. Gotcha#1!
The first warning was caused by maven-compiler-plugin beeing configured to compile for Java 1.5 while only a 1.6 JDK was available. Gotcha#2!
Hopefully this post will save other people from being as clueless as I’ve been