JUnit tests pass in Eclipse but fail in Maven Surefire

前端 未结 17 1959
臣服心动
臣服心动 2020-11-29 17:28

I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 17:53

    Usually when tests pass in eclipse and fail with maven it is a classpath issue because it is the main difference between the two.

    So you can check the classpath with maven -X test and check the classpath of eclipse via the menus or in the .classpath file in the root of your project.

    Are you sure for example that personservice-test.xml is in the classpath ?

提交回复
热议问题