how to show original file structure in intellij? - intellij-idea

I imported seldon-core to intellij, which tried to separate the files to different projects automatically.
How to disable this? I need to view all the files in original/same structure with the git repo, like:
Thanks
UPDATE
It STILL DOES NOT work now even I did the following:
When importing project, we need choose Project format as .ipr (file based).
Then, we need select Project Files

Have you tried switching between the options under projects? There is an option with project files
Project Files shows the exact file structure as your git repo.

Related

IntelliJ different project settings based on used IDE

I have a Git repo with two directories:
backend (PHP/Laravel code)
frontend (TypeScript/Vue code)
I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.
This is to ensure that searches/indexing only happen for the files that I would actually edit in that specific IDE.
When I change the excluded directory it seems to automatically apply this to the other IDE as well. Is there some way to keep this setting separate?
Comments:
I intentionally have both frontend and backend in one repository.
Opening the subdirectories in their own IDEA projects does not seem
to be an option because the Git integration only works when the
project is in the root folder of the repository.
When I change the excluded directory it seems to automatically apply this to the other IDE as well.
It is expected. That's because the project settings are stored in the .idea subfolder. All IDEA-based IDEs use the same .idea settings format. So opening the same folder/project in different IDEs simply makes them use that already-made config (shared between IDEs).
Plus, both PhpStorm and WebStorm use the same module type ID (WEB_MODULE) and can have only 1 module in total in a project. IntelliJ IDEA and some other IDEs (like PyCharm for example) can work with projects that can have more than one module and of different types.
Is there some way to keep this setting separate?
Yes, with the help of a small workaround: you need to store .idea used by another IDE in another place. As simple as that.
The setup and steps:
Lets assume that you have your project in C:\Projects\MyProject.
Make a brand new empty project in another place, e.g. C:\Projects\IDEProjectsStore\MyProject-frontend. It will be used for a frontend.
Go to Settings/Preferences | Directories and remove an existing Content Root (which will be C:\Projects\IDEProjectsStore\MyProject-frontend from the previous step).
Add new Content Root instead -- point to the actual project (C:\Projects\MyProject from step #1)
Save and configure as needed.
What you will have now:
This frontend project will now have its settings stored in C:\Projects\IDEProjectsStore\MyProject-frontend\.idea while another (original project with backend) will have them in C:\Projects\MyProject\.idea.
Projects (project-specific IDE settings) are stored in 2 separate places while they both use the same folder with the code.
Basically: a project in the IDE's eyes is an .idea folder with a parent folder added as a Content Root by default. Our workaround keeps the second project in a different folder while sharing the same Content Root between them.
https://youtrack.jetbrains.com/issue/IDEA-170102/ -- that's a ticket that asks for a straightforward way of doing this.
I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.
Why do you need two IDEs for this?
In case if you do not know: PhpStorm = WebStorm + PHP + Database. You do not really need WebStorm here. Just install any missing plugins that come bundled with WebStorm.

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:

Intellij Idea dont detect local changes of non code files

I cloned the my repo from github using Idea and i have modified some sources files and push them into git. But when i modify a file in another folder inside of the project, idea don't detect the change and this file is important for the project.
My project structure folder is something like:
-Project_main_folder/
----Game/
--------src/
------------main.java
------------other_java_files
--------libs/
----db/
--------database.sql
And when i modify the database.sql (for example), idea dont detect it changes. How can i make it detect it and upload it to github??
Thanks c:

Can't see project folders in IntelliJ IDEA

Every once in a while, I open an old project and I can't see any of the folders in the intelliJ project viewer. I can see all the files at the root.. but no folders. Yes I can delete the .iml file and .idea folder and re-create the project, but come on.. there's gotta be an easier way to fix this.
Is there?
If you look in project settings (ctrl-shift-alt-s), you should see a module structure. If you instead see "Nothing to see", do the following:
In Project Structure -> Modules, press the + button,
press enter (since, for some weird reason, it won't let me click on "New Module")
In the window that pops up, click on the "..." next to Content root, find your root folder, and select it
Press ok
ignore any warning that says the name is already in use (or to that effect)
the simplest solution worked from me, just delete the .idea folder
keep in mind this will delete all of idea's current project configuration, it'll create the folder with default settings when reload the project again... but all other configuration will be lost if not properly backed-up
It might be because the project didn't have any modules defined. Try adding existing source code by hitting File > New > Module from Existing Sources and select the parent directory of the project for source code
Go to pom.xml file -> right click -> maven -> generate source and update folders. You will see your files and folder structures in left hand side.
All the project-specific settings for a project opened through Intellij IDE are stored in the .idea folder.
The .idea folder (hidden on OS X) in the solution root contains
IntelliJ’s project-specific settings files. These include per-project
details such as VCS mapping and run and debug configurations, as well
as per-user details, such as currently open files, navigation history
and currently selected configuration.
So, if you are not able to see the project file structure in your Intellij IDE, just delete the .idea folder,
rm -rf .idea
and reload the project, then after reload you'll be easily able to get your project structure displayed.
Thank you very much. I just remove the .idea folder and works in my case.
rm -rf .idea
For me, the java folder was not showing up. I went into File->Project Structure. In the second column, I selected on _main. In the third column, I selected the tab "sources". In what I call the fourth column, where the "+Add Content Root" is shown, I verified, the java source/folder was present. In my case, there was an extra source folder, which was the current location. I removed this, applied and the java folder immediately showed up.
Right click on the Project name -> Open Module Setting -> Check the application context path set it up at your project location.
Check your idea.log -- it may have some details explaining why or what is happening (Help | Reveal log in Explorer). Possibly one of the config files got corrupted.
You can always backup and delete .idea subfolder (project settings) and re-create project from scratch. When it's wroking again (after basic configuration) you may copy some of the files from that folder back to recover some of your settings (if there were many).
This happened to me on a new computer when I opened up a Java project in the newly installed Intellij.
The problem was that I had not installed any JDK on the machine.
I had to install a JDK and then go into the settings at ctrl-shift-alt-s and add a JDK by specifying the folder where I installed it. It's possible that IntelliJ would have found it if I closed it and reopened it.
In my case the solution was to create a new project, specifying the project type and creating it within the same directory path as the project that does not load the project files correctly.
PhpStorm automatically detects that the directory exists and gives you the option to create project from existing sources.
This can be found under:
File --> New project...
For gradle users: "Reload All Gradle Projects" option should help.

How can I clone a whole project in IntelliJ Idea?

I want to run some tests in my project but I do not want to affect the
original code, and I wanto to clone the project so I can run tests there
Does anyone know how to clone a project on IntelliJ Idea 11?
Using your operating system File Explorer tool, just copy and paste the entire project directory somewhere new. All of the configuration should use relative paths by default.
If your IDEA project is .ipr based, then delete the new .iws file before opening the project.
If your IDEA project is .idea directory based, then delete the workspace.xml file before opening the project.
If you want to copy and rename the project too, like I wanted to clone a project in order to use it with a newer version of IntelliJ.
Copy the whole directory to a new location, for example on Linux:
cp -r myproject new/location/
To rename the project:
2.1. rename the project folder (e.g. mv myproject newproject)
2.2. get into the new project folder (e.g. cd newproject) and edit the .name file with a text editor.
Open the new project now in IntelliJ (you may want to remove the workspace.xml if you don't want to keep the open file history - I kept it) and enjoy your new project!
For copy with rename I had to do one more step to get it to stop referencing the old module name. That was to right click on the module in the project pane and do Refactor > Rename ( or do Shift + F6 ) to rename the module.
This was for IntelliJ IDEA 2016.3.3
I had a gradle project and the provided answers did not work. The project did not have a structure in IntelliJ and I did not see the source files.
The following worked:
Export project (Export to zip file)
Move the zip file somewhere new
Unzip
With IntelliJ, import as a new project with "open".
Better Solution of course:
Have it in a git directory, make a "test-branch" and try whatever you want to try.
Apparently the accepted answer doesn't work anymore with current versions of Idea and the many derived IDEs (I tried this with PHPStorm). The problem: most of the config files are located in the .idea subdirectory of your project, but the file .idea/workspace.xml also contains the ProjectId, and that should of course be unique. So, if you copied the project directory manually, the easiest fix is to change the ProjectId - from what I have seen you can enter any alphanumeric string, e.g. "ProjectId123".
As far as I can see the main settings that are stored under the ProjectId are the workspace settings, under ~/.config/JetBrains/[IDENameAndVersion]/workspace/[ProjectId].xml. This file mostly contains the open editor tabs (with paths relative to the project directory) and the tool windows, so if you copy the project directory, you will always have the same editor tabs open in both projects (containing the "same" files, but from the respective project). If you want to avoid opening all files and setting up the tool windows, you can copy the old [ProjectId].xml file to e.g. ProjectId123.xml (using the ProjectId that you entered earlier).
After Copying your existing Project to a new folder don't forget to mark your src directory as Source directory. You can do this under Project Structure | Modules.
To duplicate and rename a CLion cmake project I followed the info in the other answers with some tweaks.
What seems to be the stepless way to eliminate all references to the old project name in the new one (tested with CLion 2019.1.2):
Copy folder
rename the new folder
On the new project folder:
delete the project info folder (CLion will recreate it):
<new project name>/.idea
On a text editor, open:
<new project name>/CMakeLists.txt
change every reference to the old project name with the new name and save it.
This will assure CLion will not use Project and Target info in "CMakeLists.txt" file to recreate project files and data in ".idea" folder with the old name.
Note that other info in this file referencing the old project folder, or files stored there, such as INCLUDE, SOURCE directories, and files, should also be changed to point to the new folder.
delete old compile data. Delete folders like:
<new project name>/cmake-*
Open project in CLion
It should have the new name and no reference to the old name anywhere.
If using CSV, you may also wish to delete old CSV data
EDIT: If project requires CUDA, CUDACXX environment variable must be reassigned to full path of nvcc compiler:
File->settings->Build, Execution, Deployment->CMake->Environment
IF CLion CUDA Run Patcher is installed it maybe needed to restart CLion.