Berto Yáñez
Berto Yáñez

Reputation: 1071

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.

Upvotes: 12

Views: 2030

Answers (5)

tobiash
tobiash

Reputation: 860

My project's .idea/<project>.iml file had an entry:

<orderEntry type="inheritedJdk" />

I quit Idea, removed the line above from the iml file, restarted Idea and the next Inspection ran without any issues.

Upvotes: 4

y2k-shubham
y2k-shubham

Reputation: 11607

I recently ran into this issue with my purely Python project. After much frustation, I bumped into a rather bizarre solution:

When IntelliJ complained that JDK is not configured, in the following dialog box, I just selected JDK8 (instead of Python 3.7.2 path) and viola! its gone.


My environment was

IntelliJ IDEA 2018.3.4 (Community Edition)
Build #IC-183.5429.30, built on January 29, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.2

Upvotes: 0

Armando Garza
Armando Garza

Reputation: 534

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.

Upvotes: 9

Ben Creasy
Ben Creasy

Reputation: 4136

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

Upvotes: 6

Berto Y&#225;&#241;ez
Berto Y&#225;&#241;ez

Reputation: 1071

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.

Upvotes: 1

Related Questions