Eclipse - java.lang.ClassNotFoundException
I've come across that situation several times and, after a lot of attempts, I found the solution.
Check your project build-path and enable specific output folders for each folder. Go one by one though each source-folder of your project and set the output folder that maven would use.
For example, your web project's src/main/java
should have target/classes
under the web project, test classes should have target/test-classes
also under the web project and so.
Using this configuration will allow you to execute unit tests in eclipse.
Just one more advice, if your web project's tests require some configuration files that are under the resources, be sure to include that folder as a source folder and to make the proper build-path configuration.
Hope it helps.
Carlos approach helped! Eclipse - java.lang.ClassNotFoundException
Try to check the classpath of the junit run configuration:
- Open your run configurations
- Click on the jUnit-Test you want to start
- go to the classpath tab
- Try to add a folder (click on user entries, click on advanced, click on add folders, click on ok and search the outputfolder for your test classes(those you find under projektproperties java build path, source))
works for me.