loader constraint violation

Answered

Hi, 

I'm trying to load my .git directory with JGit and I get this error:

loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader com.intellij.ide.plugins.cl.PluginClassLoader @6d570eef (instance of com.intellij.ide.plugins.cl.PluginClassLoader, child of 'bootstrap') of the current class, org/slf4j/LoggerFactory, and the class loader com.intellij.util.lang.UrlClassLoader @61f8bee4 (instance of com.intellij.util.lang.UrlClassLoader, child of 'platform' jdk.internal.loader.ClassLoaders$PlatformClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature

 

I added this dependency: compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.5.1.201910021850-r'

And my code is:

Repository existingRepo = new FileRepositoryBuilder().setGitDir(new File(project.getBasePath() + "/.git")).build();

Any idea how can I solve it?

Thanks

1
1 comment

Changing the dependency to: 

compile ('org.eclipse.jgit:org.eclipse.jgit:5.5.1.201910021850-r') {exclude group: 'org.slf4j'}

solved it

1

Please sign in to leave a comment.