No Persistence provider for EntityManager named myTestPersistenceUnit
So what’s the problem here? I looked through my dependencies and everything looks great.
The first thing I stumbled upon was, that I need to put the persistence.xml in the META-INF folder, because Gradle doesn’t copy it to this folder. An big difference from the Ant buildscript.
But that change didn’t fix it.
After reading and searching many hints and tips I figured out, that the next problem was, that I need to import also this dependency
Now this exception was gone but a new one occured
Unable to configure EntityManagerFactory ....
org.hibernate.HibernateException: Unable to get the default Bean Validation factory
But I’ve already defined this dependency! What’s now the problem? The last problem was, that I need to change the used version from 3.1.0.GA to 4.2.0.Final of ‘org.hibernate:hibernate-validator’. This must be done, because the version 3.1.0.GA isn’t an implementation of the JSR303 provider.
So that was hard work, but finally I’m now able to kill the Ant Skript and ended up with this compile dependencies: