Intellij project opening directory above project - intellij-idea

I feel kind of silly asking this but I've been poking around and I don't know what is causing it. I have a directory structure that has a number of projects in it, it looks like this:
projects_root/project1
projects_root/project2
projects_root/project3
When I open any of these projects with Intellij it instead opens up the projects_root directory, so that all the projects in the directory are opened under my project tab. This is annoying as it clutters up my project view and it's causing some issues with my debug configurations etc. The strange thing is this was working fine until yesterday, that is opening project1 would open at the root of project1 instead of projects_root. I've changed no settings, the behaviour seemed to just start out of the blue. Has anyone seen behaviour like this before? Could anyone recommend a fix for this?

It appears that the content root of your IntelliJ project is incorrect. I can't tell you the cause for why this happened but you should be able to fix the content roots without needing to recreate each of the projects.
For each project, open up the respective IntelliJ project and follow the steps for removing a content root for all of the non-applicable content. E.g., for project1 remove projects_root/project2 and projects_root/project3.

Related

How to move project directory in IntelliJ IDEA EduTools?

I'm using IntelliJ IDEA EduTools and chose a project from JetBrains Academy. The plugin decided to create the project directory at some arbitrary location. I tried moving it by choosing Refactor -> Move at project root but a message box pops up saying "This move operation can break the course". I tried deleting the project directory and re-open the project from JB Academy, but EduTools seems to remember the decision and created the project directory at the very same location.
So my question is, how do I move the project directory to somewhere else?
Thank you for reporting this.
You can move the project directory anywhere using your File Explorer and import it back to your IDE using Open or Import on the Welcome Screen.
You'll see the project with the previous location marked as unavailable on the left of the Welcome Screen. Please click ⨉ to remove this project.

IntelliJ IDEA - Directories appearing in Project Files but not in Project

So I created an empty project, but when I create a new directory in the Project window, it does not show up. The directory is actually created, and if I navigate to the Project Files list I can see it there, but as far as I can tell there is no way to make even my src folder part of the actual project. This creates all kinds of problems when I have to move/refactor files, and I'm amazed that something so common and simple is so difficult.
You've created a folder, not a package. If ur using maven or grade, can I suggest u use them to generate an intelij project for you. The command escapes me but a quick Google should tell you
You can manually mark your directory as a sources root:

open same project in both webstorm and intellij and prevent asking "project file changed" window

I want to get rid of the annoying popup window when opening the same project in both webstorm and intellij. This window constains
Project components were changed externally and cannot be reloaded:
RunManager
editorHistoryManager
ToolWindowManager
ProjectRootManager
ChangeListManager
FileEditorManager
Would you like to reload project?
Is there a way to do that?
Thank you.
The problem is that WebStorm and Idea use the same project format (https://www.jetbrains.com/webstorm/help/project.html#d1374457e109), but have different module types, settings, etc. So, it's strongly recommended to avoid sharing the project settings (.idea) between WebStorm and Idea.
If you like to proceed with working on your project in both IDEs, I can suggest creating a separate project to be used in WebStorm: create a new empty WebStorm project anywhere and then add a folder where your javascript, HTML, etc. files are stored as an additional content root to it using Settings/Project/Directories, Add content root.

IntelliJ IDEA not showing my module/project

Suddenly, IntelliJ IDEA is showing the following module view with a strange yellow colour in the background. I don't know how to get my module back, because it is not being shown:
Do you know how can I see my project folder back?
Thanks
This is way late, but deleting my .idea folder did the trick.
Close IntelliJ
cd <project-path>
rm -rf .idea
You can go to File-> Project Structure and then define it as a Source Folder
In Intellij, Right click on your parent pom file and click add as maven project
For Maven Projects that don't show up you can right click your pom.xml and click 'Add as Maven Project'.
In my case Modules kept on disappearing and I managed to fix it with these simple steps:
In the Project panel, right click to see the context menu
Select "Open Module Settings"
Select the Module that is not shown in the tree view
Select the first tab labeled "Sources"
Press the "+ Add Content Root" link
Select the root folder where the files for this module are located
Once the folder has been scanned, press the OK button and you will see the Module appear
I had a similar issue. Other answers did not solve the problem for me.
I ended up uninstalling IntelliJ, then installing a new copy. When prompted to import previous settings, I selected the option of not to import, then set up IntelliJ from scratch. After re-install/re-setup, I was able to open my project folder and all of the modules showed like before. Some how my IntelliJ got fubared, my guess is that it happened when I updated it last week.
For me, I must've deleted my .iml file somehow. Files with .iml contain configuration for your modules. The problem was that my project module was not being loaded without it. I'm using gradle, syncing my project with gradle regenerated whichever *.iml was necessary to build. Here is a post that provides a succinct explanation.
IntelliJ IDE | .iml File lost or deleted
Also - I know this issue is probably long gone and out of his head but for whoever may come across this issue, the above was the solution for me.
Check if the FACETS panel is blank
If it's blank .Then click the "+" button to add
one.
For me .I need a android facet.
For details.go to this link
Hope this is work for you.
I assume you are used to working with Eclipse. Intellij IDEA uses the same idea, but different names.
A Eclipse workspace is equal to IDEA's project.
A Eclipse project is equal to IDEA's module.

All IntelliJ run configurations disappeared

After IntelliJ IDEA froze and was killed from the task manager, all the Run/Debug Configurations disappeared. I have tried invalidating caches, reloading files from disk, synchronizing and restarting, but nothing helped.
You can try to restore your Run configuration using the Local History feature of IntelliJ IDEA.
If you are using .idea directory based format, then your configurations will reside in workspace.xml file under .idea directory, invoke Local History dialog from the .idea directory right click menu in IDEA Project View, select the label some time before the crash and revert the old copy of workspace.xml.
In case .ipr file based format is used, your configurations will be stored in the <project>.iws file in the project root which you can restore in a similar way.
If the configurations were Shared, they are stored in .idea\runConfigurations directory as separate XML files or in the <project>.ipr file (if old project format is used).
If the Local history is blank and you are in Windows, try Restore previous versions right clicking the workspace.xml file or the <project>.iws one in Windows Explorer.
You can go to your main project and right click on it, select local history --> show history. Find some point in time where you think that system was stable (before crash) and click revert. This worked for me.
To me, this frequently happened on switching branches. Turning off "restore workspace on branch switching" helps to prevent the run configurations from getting lost.
Edit: Not sure if it actually has an impact, it still seems to happen to me sometimes, maybe less frequently though. I'll leave it here since the answer already has some upvotes, so maybe this was the solution for someone...
For every project in intellij there's a file created with all the configurations related to it.
Under the root directory of the project there's a hidden folder .idea in it is the workspace.xml with the configuration. workspace.xml is comprised of components one of which is responsible to hold the run/debug configurations.
If this file is getting corrupted it's difficult to restore these configurations if you don't have a backup of workspace.xml. to overcome it:
1. in intellij right click the workspace.xml file under project view and choose Local History -> Show History
2. if there's no history you can copy the component from a coworker with similar configurations.
3. backup in advance the workspace.xml and retrieve the RunManager component from it..
another good choice is to use the share option.
under each project's definition there's a checkbox share
Marking this checkbox will extract the definition for this project to an external location:
under the same .idea folder a new folder is being created runConfigurations and the configurations per project are being represented there in xml files.
The advantage of using share is that it can be copied and used for similar projects under other branched like QA and production
In my case, i've accidentally pressed Alt + Home and this bar disappeared, this combination toggles run bar at the top of IDEA window for me.
Here the screen with my bound actions on this keys. I hope it should help
Run configurations are stored in your project files. When IntelliJ (or your computer with IntelliJ running) crashes hard, the project files can become corrupted and unreadable. I don't know of a way to recover this unless you have your project files are backed up somewhere.
Navigate to your project folder and check weather any .idea folder is created or not,
if created copy your project and paste it other location ant try opening it;
it will work.
I sometimes have the problem that all the run/debug configurations are not created from CMake after being lost. I solved this by just deleting the whone list of configurations from the workspace.xml (from .idea folder).
This happened to me recently and I just restarted IntelliJ and they shared ones (in .run) are now restored.
In my case what happened was I did something that made IntelliJ recognize the project as a new application type, so it thought my old configuration was not valid for my project anymore and wasn't displaying it to me. I reverted my changes and the configuration appeared as an option again.
I guess this feature can't be removed from IntelliJ but I guess this can help:
Run/Debug configuration functionality might be hidden, so to show it go to:
View/Appearance/Navigation Bar
Very annoying problem in Intellij Idea for many years.
It's quite often breaks because of broken (connection to?) Ant debugger, used to create run configs.
I was periodically searching for a solution, but no success. Then today after disappeared Run Config to display in panel I did inspect contents of workspace.xml. All the run configs were there.
And then it turns out to be 7+ years bug clue...
Always spring out non-called Ant...
Happily, contents of workspace.xml in place with all your run config items, you can just
disable infamous plugin Ant debugger,
reload the project,
and all your run configs are displayed and available again))).
Happy to share with all of you the solution).