Why is the *.iml file stored in project root?

Hello everybody,

the title says about all i want to know.
Isnt the *.iml file supposed to be located in the .idea folder? Why is it (by default) saved in the projects root folder?

I know i can save it wherever i want, but its just so annoying to not know why the jetbrains developers decided to do it like this.

Hopefully some of you know the answer, as i was not able to find any information about this.

Best Regards,
Philipp

EDIT: maybe good to mention that i mostly use IntelliJ to create WebApplications (PHP, HTML, CSS, JS...)

8 comments

Hi Philipp,

I see at least two reasons for that:

  1. IJ used to use *.ipr file for keeping project info, i.e. it was not possible to keep *.iml at .idea dir as there was no such directory;
  2. It's easier to import a module from another project when module config file is kept at the module directory;

Denis

0

Hi Denis,

thanks for your answer!

So the iml file should be in the .idea directory? Its just not possible because the system has changed?
I really like jetbrains products, but things like this are extremely annoying for me. Any chance to see this "fixed" in the future?

Best regards,
Philipp

PS: i cant agree with your second point, you just made this one up :p

0

I'm afraid I don't understand what kind of fix do you expect - it's possible to customize module configu file location on new module construction. It just defaults to module content root dir. Do you propose to change default locationt to .idea instead?

Denis

0

As far as i understand this file, it should be located in the .idea directory.

Dont get me wrong, i know its not a bug or something, but its a strange default behaviour as it should be located with all the other project files (in the .idea directory).

1

There is a lot of other files which are located outside .idea :)

Basically, .idea holds project-level configs, there is also an app-level dir (defined at idea.config.path property at $IDEA_HOME/bin/idea.properties). Module-level changes are stored at *.iml which is located at module content root by default.

Denis

0

i'm relatively new to IDEA.  i've somehow accumulated a bunch of *.iml files in my project root, and i'd prefer to have them somplace else.  my question is, how can i move the *.iml files without messing up my projects?

0

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.

0

@Yaroslav, thanks for your answer.

0

Please sign in to leave a comment.