Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue importing a Java project (gradle) in IntelliJ

I have a gradle project that builds perfectly. The jar runs perfectly. When I try to import it into IntelliJ via gradle, I get the following error:

Unable to load class 'org.slf4j.LoggerFactory'.

I don't even use that within my project.

Any ideas?

Here is a gist with the log: https://gist.github.com/anonymous/991f8daab0ff3047db9a11d015492fe5

Also, an screen shot for reference: http://imgur.com/a/2ptIY

like image 503
Tyrick Avatar asked Jul 23 '16 00:07

Tyrick


2 Answers

I had a similar problem: while trying to open a Gradle project, IntelliJ throws an error: Unable to load class 'org.slf4j.LoggerFactory'.

Instead of the local gradle distribution, choose the "use gradle wrapper" task configuration option. You can change this in Settings | Build, Execution, Deployment | Gradle | Project-level settings

like image 126
villasv Avatar answered Oct 17 '22 00:10

villasv


IntelliJ uses it internally alongside many other libraries - you may want to check the JAR to see if it's still valid. It lives in <INTELLIJ_DIR>/lib. If not, you can replace it manually (IntellIJ 2016.2 packages log4j 1.2). If you encounter further issues, you may have other corrupted libraries (at least that was the case when this happened to me). As far as I'm aware there's no simple way to repopulate the lib folder, so the cleanest solution may just be a reinstall of the IDE if it proves to be tedious to manually fix.

like image 38
Max Roncace Avatar answered Oct 17 '22 01:10

Max Roncace