IDEA clobbering modules with same directory name

Hi All,

I have the following project structure:

module bar in /bar/bar.iml
module in /foo/bar/

Whenever I restart IDEA, it decides that the two modules are the same and /bar/bar.iml gets overwritten with the data from

Anyone else have the same problem? Any solutions?


Comment actions Permalink


Can't reproduce.

You can take a look at the project's .idea/modules.xml. Are both paths to the .iml files, including all directory and file names, correct?


Comment actions Permalink

I should also say that I'm using gradle for the new module. Here's exactly what happens:

- Module /bar/bar.iml already exists (and it's an ant module).
- I create gradle project /foo/bar/
- I restart IDEA
- Problem: IDEA seems to then create /foo/bar/bar.iml, and module.xml has the correct info for /bar/bar.iml and /foo/bar/ BUT it also has the new module /foo/bar/bar.iml, and the info from /foo/bar/ gets written into /bar/bar.iml

I've tried fixing it multiple times but everytime I restart, it breaks. I'll try it in a clean project and see if I can reproduce and post it.

Comment actions Permalink

I was able to reproduce part of the problem on creating a module, but not the whole problem. Here's what to do:

  1. Create a new Java project: ~/tmp/test
  2. Create a new Java module:
    • module name: bar
    • Content Root: ~/tmp/test/bar
    • Module file location: ~/tmp/test/bar
  3. Create a new Gradle module:
    • Module name:
    • Content root: ~/tmp/test/foo/bar
    • Module file location: ~/tmp/test/foo/bar
  4. Select all the defaults for the Gradle module
  5. Note how the original bar module is no longer specified as a module in the navigation tree.
  6. Open the Project Structure window, select the bar module, and note that the content root was changed to ~/tmp/test/foo/bar
  7. In a text editor, open ~/tmp/test/bar/bar.iml and note how all the paths have been changed to the location.

When I replace ~/tmp/test/bar/bar.iml with its previous version before adding, IDEA restarts OK.

My original project has many modules, and the interaction might be causing the extra breakage in the modules.xml and the creation of the additional .iml as my previous message specified. LMK if there's anything else I can do. For now, I've given up and now just make sure that each directory I create has a unique name...

Comment actions Permalink

Jad, thank you for reporting this! I've created



Please sign in to leave a comment.