Intellij Plugin clashes with JPA Hibernate



I build a little plugin for Intellij that also utilizes JPA with the Hibernate distribution. Unfortunaly the plugin isn't able to connect to a database. 

Every time i run the code of my DBConnector class: 

EntityManagerFactory emFactory = Persistence.createEntityManagerFactory("default");

the plugin chrashes with the Exception: 

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
    at javax.persistence.Persistence.createEntityManagerFactory(
    at javax.persistence.Persistence.createEntityManagerFactory(
    at repositories.DBConnector.getConnection(
    at repositories.EntityRepositoryImpl.<init>(
    at repositories.EntityRepositoryImpl.<clinit>(
    ... 54 more

I debugged a little bit into it and it appears that the com.intellij.util.lang.PathClassLoader can't load the HibernatePersistenceProvider.

The persistence.xml is within the main/resources/META-INF folder and works fine when deployed in another application than an Intellij Plugin. 
Also in Project settings in Facets the correct path is set. 
All Hibernate and JPA dependencies are set in the build.gradle 

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation 'mysql:mysql-connector-java:8.0.29'

Any Known Solutions to this problem?