Move .iml files to other directories?
Answered
Hi
I'm running into problems with my project structure. My .iml files are all located in the root directory. I have problems running junit Tests which reads files, then it looks in the root dir instead of the module dir.
$MODULE_DIR$ is set, but is referencing to the root because there is the .iml file.
So, how can I move them to the corresponding modules? Does just moving breaks something? Or is there an option in the project settings? I can't see one.
Regards
GarfieldKlon
Please sign in to leave a comment.
Hello.
Unfortunately, this is not supported yet: http://youtrack.jetbrains.com/issue/IDEA-111848
To do it manualy, please backup (commit) your project first.
Then you can try the following:
. (You may close the project to avoid interaction with IDE.)
. Move .iml to proper location.
. Revise and correct all paths in the .iml. E.g. instead of [content url="file://$MODULE_DIR$/module-name] set [content url="file://$MODULE_DIR$], and so on.
. Correct the paths in .idea/modules.xml for that module.
Various references directly into module content (not via module name), if you have any, should be corrected additionally.
Regards,
Alexander.
Hi all,
Replies to this thread may no longer be relevant, but this is supported in the latest verisons of IntelliJ.
Dragging a file *.iml to a new folder in the from the Project Tool Window (⌘+1 / Alt-1) within IntelliJ will prompt a Move File Dialog for the .iml file.
Selecting the checkbox Search for references will find and update all references to the .iml file throughout the project.
Thanks Jpayoung! Seems to work :)
I much prefer this file to live under the .idea folder, especially when contributing to a project owned by somebody else. It's much more common for .gitignore files to already have .idea listed. Adding .iml to somebody else's .gitignore is not ideal.
I don't understand Jetbrains... it's like they have 12 different teams going in different directions, removing functionality, adding it back, changing it without updating documents... a little nutts!
Anyway, they used to have this option to store them in .idea folder, now they have a more confusing option called "store generated project files externally" which seems to accomplish the same thing and I assume moves the iml files somewhere in the user directory.
Jpayoung's solution no longer seems to work for me. After dragging the `.iml` file into the `.idea` folder, I then need to open `./idea/modules.xml` and update the path to the `.iml` file manually by adding `.idea/` in between `$PROJECT_DIR$/` and the `.iml` file name.
Agree with gunslingor gunslingorsadf that this situation is quite annoying.
3 years later… the 20 year year old problem that was fixed, broken, fixed, broken… is still broken. Great turnaround time!
gunslingor gunslingorsadf
IJPL-8707 is already fixed. The fix is included into version 2024.2.1 of IntelliJ-based IDEs.
If you still have a problem in the recent versions of your IDE, please submit a new ticket about it to YouTrack describing the problem in detail.