inteliJ IDEA don't store the project informations - intellij-idea

Every time I create a new project in InteliJ it creates only a iml file, and I cannot see my file and libraries. But after I close the project and make the same project by override, it works.
I suspect it's something from the settings, but I don't know where.
I use IntelliJ IDEA 2021.3 (Community Edition)
Build #IC-213.5744.223, built on November 27, 2021
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 7 6.1
PS: I am looking for a more permanent solution, as it gets fustrating..

Well, it seems that it has a small bug.
When I make a new project, I have 2 ways of creating in:
by choosing a name in the Project name field, and then obtional choose the path manually if required. This works very well.
by skip the first field and live untitled as it is, and choose the path in the Project location field, creating a new folder, and then when you came back the Project name field is with the name of the folder, but when I click finish, I can not see modules, compiler settings and SDK selected. (see the picture from the question)

Related

Intellij shows every line in build.gradle.kts is red

I created a new project from VCS (Kotlin and Gradle). I added three testImplementation() calls to the build.gradle.kts. IntelliJ didn't pickup the changes so I did File -> Invalidate caches / Restart and now Intellij shows every implementation() call and every testImplementation() call in red. In fact every line in every build.gradle.kts in every module is red.
Intellij has lost its mind. What do I have to do to restore IntelliJ's intelligence when it comes to kotlintest in Gradle?
I started seeing this with AS 4.2.1. Invalidating caches and re-importing the project didn't work for me. I found this article on the JetBrains issue tracker where people found that they had an extraneous JDK set in the project settings. While I did not have an extraneous JDK set in my project structure, I tried changing the JDK from the AS embedded version to an alternate AdoptOpenJDK 1.8 version I had installed. After switching to that version all the red went away and everything is resolving as expected. I was then able to switch the SDK back to the embedded version and everything continued working as expected. When switching back to the embedded version I did notice a brief message in the progress bar at the bottom of AS saying that it was processing a JDK 11. I'm not sure where that's coming from, but it does seem to be in line with what others in the JetBrains issue were talking about.
The way I was finally able to solve this was with File -> Invalidate caches / Restart. It must have been cache corruption.
What do I have to do to restore IntelliJ's intelligence when it comes to kotlintest in Gradle?
Re-import the project: File | New | Project from Existing Sources action and select build Gradle file to load the project from.
Change your jdk.
Go to File>Project Structure > SDK Location > GradleSettings
Change the Gradle JDK to use the embedded or a compatible JDK (Azul JDK) if you're using a MAC.
Then Invalidate and refresh cache after deleting the .idea and .gradle files.

IntelliJ IDEA adding numbers to project name

When I "Create a new project from existing sources" in IntelliJ IDEA, it adds _#### to the end of the project name, where #### is a seemingly random 4-digit number.
This happens with this version:
IntelliJ IDEA 2018.1.5 (Community Edition)
Build #IC-181.5281.24, built on June 12, 2018
JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.5
I know how to rename it, but how can this be disabled?
There is an open bug logged for SBT subsystem in IntelliJ IDEA. Please follow it for updates.
It appears that import doesn't complete properly for some reason.
UPDATE: SCL-13617 is the correct issue to follow.
This behavior was a workaround for another bug and will be changed in the 2018.2 release of the Scala plugin. Instead the import chooses the project directory name as project name.

How to change project's java version in Intellij Idea?

I reinstalled java on my laptop with different version, and after that, my project can't run well in Intellij Idea. So I want to know how to change project's java version in Intellij Idea?
Make sure that the compiler correctly chose the version:
You need to go to Settings > Compiler > Java Compiler and update the Target bytecode version
Easier: press Shift twice and type Java Compiler and will lead you to that.
Setup the project SDK
Go to Project Structure > Project > Project SDK and add the link to the local Java file
File | Project Structure
Add your new SDKS, and chose right sdk for your Project.

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.
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.
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.
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.
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.
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

Intellij project between Windows and Linux - use the 'default system provided' JDK?

I've got two dev workstations, one running Windows, the other running Linux. I work on a Java project using Intellij on both. Both platforms have the Oracle JDK 7 installed in the default locations.
For some annoying reason, every time I switch platforms, I need to update the project configuration to specify what JDK it should be using. In the project's "Project SDK" setting, there's a JDK selection which includes two entries - 1 for a JDK in c:\Program Files\Java\jdk_1.7 and the other for a JDK in /usr/lib/jvm/java-7-jdk/. If I open the project on Linux, I have to specifically set the Project JDK to be the second. If I save the project, close, commit, and then checkout and open on Windows, it complains it can't find the JDK, and I have to manually set it to the Windows version.
Why can't Intellij figure this out automatically? I appreciate that testing against multiple installed JDKs is a useful feature, but is there a way to tell a project to 'just use the default JDK'?
You need to have your JDK configurations to have the same name, lile 1.6 or 1.7. Project file references JDK by its name only so it will work out of the box in all IDEA installations on different operation systems, the only requirement is that there is JSDK defined under exactly the same name.