I wrote a JUnit test case for JPA using spring. The testcase passes in eclips. But if I execute the same testcase using maven (mvn test) it fails.
My test case is :
I have solved this problem. The problem was mainly because of the dependency
javaee
javaee-api
5
provided
Actually this dependency was required for EJB so I placed this in my parent pom (and also in my testcases pom). Since my test case's pom had a parent depedency, by default it will be inherited. If you add this dependency then u must have a java EE container to run the program. Testcase does not require Java EE container.
Remove this dependency if you have the one in your pom file.
Have a look on Problem running unit tests from maven (JPA related) for more detail.