JUNIT Test class in Eclipse - java.lang.ClassNotFoundException

后端 未结 26 1956
栀梦
栀梦 2020-12-14 13:55

I\'m trying to run my junit test (to verify that a properties file loads correctly) but I get ClassNotFoundException although the class is there and all requir

26条回答
  •  执念已碎
    2020-12-14 14:30

    I tried everything mentioned here and in other posts. Some of the solutions that people proffered were:

    1. Change the output folder for the test
    2. Create a custom builder for the project that would run test-compile from Maven
    3. Move the Maven dependencies higher in the Order and Export list in the project build path

    There were many, many more but the one that I found to work was as follows: Close the development environment. Delete the jars used by the project from my local Maven repository. Open the IDE. Build the project. Run the test.

    After hours of beating my head against my keyboard and following suggested solutions, this one worked!

提交回复
热议问题