2008/06/26

Maven Integration for Eclipse and ClassNotFound exception

I have been using Maven Integration for Eclipse plugin for some time and I am very fond of it. It is awesome. I imagine there is no a single solution to the problem of bridging two java project meta-descriptors - maven's represented by pom.xml and eclipse's represented by artifacts like .classpath and .project. The way it is implemented in this plugin is just awesome.

There was only one problem I have encountered while using m2eclipse plugin. After upgrade to 0.9.4 release, my eclipse-maven projects stopped working with ClassNotFound exception when being run from eclipse as whether Applications or JUnit tests. It was caused by a change introduced in default eclipse output folders for maven projects. It use to be target-eclipse/classes and is target/classes now - just like standard maven output directory. There is a rationale behind this change.

In order to fix the problem just select a project and choose Maven > Update Project Configuration from context menu. I've spent some time trying to understand what is going on - probably some kind of warning should be shown in case of projects with legacy paths. I hope this entry could help someone having similar problem.

m2eclipse plugin is on a good way to become a project under eclipse umbrella, great.

12 comments:

  1. you've just saved my day! thanks!

    ReplyDelete
  2. Thanks and lot :)

    ReplyDelete
  3. A simple solution to a complex problem - thanks!

    ReplyDelete
  4. This was driving me crazy. Good work ! :)

    ReplyDelete
  5. Great, thanks for the tip!

    ReplyDelete
  6. You are my hero !! Thanks a lot !!!

    ReplyDelete
  7. Thanks a lot, I tested many other possible solutions but none worked.

    ReplyDelete
  8. thanks .. yes you have saved my day too

    ReplyDelete
  9. Anonymous1/3/10 22:47

    Thank you very much, this saved me a lot of time.

    ReplyDelete
  10. Black007pl30/10/11 16:38

    Thanks for this, I was looking solution all day... I have to write it down somewhere :D

    ReplyDelete
  11. i cheked out this solution but still m getting the same problem.classnot found exception.plz help!!:-(

    ReplyDelete