Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inspecting code on a non-java IntelliJ IDEA project

I'm using IntelliJ IDEA to build a non-java project, it is just a PHP + Javascript project, everything is working just fine but when I try to Inspect all the code in the project (Analyze -> Inspect Code) I get an error:

The JDK is not configured properly for this project. Inspection cannot proceed.

Am I doing something wrong? Do I have to configure an SDK even though the project is not java?

Note: The automatic code inspection for working files opened in the editor is working fine, the only problem is when I try to inspec all the code in the project.

Note 2: I cannot use PHPStorm neither Webstorm.

Thanks.

like image 497
Berto Yáñez Avatar asked Jun 21 '16 07:06

Berto Yáñez


People also ask

Is IntelliJ IDEA only for Java?

Though designed primarily for Java development, IntelliJ IDEA understands many other programming languages, including Groovy, Kotlin, Scala, JavaScript, TypeScript, and SQL, and it provides smart coding assistance for each of them.

Can IntelliJ work without JDK?

To develop applications in IntelliJ IDEA, you need a Java SDK (JDK). A JDK is a software package that contains libraries, tools for developing and testing Java applications (development tools), and tools for running applications on the Java platform (Java Runtime Environment — JRE).


3 Answers

In my case, I didn't wanted to delete the module since I have a bunch of stuff configured (data sources, dictionaries, http requests) and a lot of code in the shelf (which I believe it's stored along the project/module). I found that you can skip the "delete your module" part and instead just update the module config:

Find the $module.iml file (in my case it's inside the .idea directory) and at the top there's was a line:

<module type="JAVA_MODULE" version="4">

which I changed to:

<module type="WEB_MODULE" version="4">

The issue was fixed and I haven't seen any side-effects but, just in case, you might want to backup the .idea directory.

like image 168
Armando Garza Avatar answered Oct 16 '22 15:10

Armando Garza


I raised this over at https://youtrack.jetbrains.com/issue/IDEA-188017 - after some back and forth, the Jetbrains employee helped me figure out that I had a Java module in there.

If you are not using Java, please crate a module of a Static Web type. Now you have a module of a Java type, that is why the error is reported, so such behaviour is expected.

Delete your Java module. Once you enter in the menu in the screenshot below, find the Static Web type and create your module like that.

enter image description here

like image 6
Ben Creasy Avatar answered Oct 16 '22 14:10

Ben Creasy


Seems like adding a SDK the code analyzer works just fine, even though the project has no single java module.

Maybe it is a bug, so I will report it.

like image 1
Berto Yáñez Avatar answered Oct 16 '22 16:10

Berto Yáñez