title: IntelliJ Project Structure full of "... and modules" and duplicates
body: <p>I have to the following folder structure:</p>
  
  <pre><code>main
  - server
  -- server-module-1
  --- a
  --- b
  --- c
  -- server-module-2
  --- d
  --- e
  --- f
  - client
  -- modules
  --- client-module-1
  --- client-module-2
  --- client-module-3
  - war-module
  </code></pre>
  
  <p>Maven Structure is similar - main pom.xml:</p>
  
  <pre><code>&lt;modules&gt;
      &lt;module&gt;server&lt;/module&gt;
      &lt;module&gt;client&lt;/module&gt;
      &lt;module&gt;war-module&lt;/module&gt;
  &lt;/modules&gt;
  </code></pre>
  
  <p>The problem begins if I move one module to a separate profile since I don't need the war-module always (on Jenkins).</p>
  
  <pre><code>&lt;modules&gt;
      &lt;module&gt;server&lt;/module&gt;
      &lt;module&gt;client&lt;/module&gt;
  &lt;/modules&gt;
  
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;createModule&lt;/id&gt;
          &lt;modules&gt;
              &lt;module&gt;war-module&lt;/module&gt;
          &lt;/modules&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>After this change, my IntelliJ my project structure looks like this:</p>
  
  <pre><code>main and modules
  - client and modules
  -- client-modules and modules
  --- client-module-1
  --- client-module-2
  --- client-module-3
  --- modules
  ---- client-module-1
  ---- client-module-2
  ---- client-module-3
  -- client
  --- modules
  ---- client-module-1
  ---- client-module-2
  ---- client-module-3
  - server and modules
  -- server-module-1 and modules
  --- a
  --- b
  --- c
  -- server-module-2 and modules
  --- d
  --- e
  --- f
  -- server
  --- server-module-1
  ---- a
  ---- b
  ---- c
  --- server-module-2
  ---- d
  ---- e
  ---- f
  - main
  -- client
  --- modules
  --- client-module-1
  --- client-module-2
  --- client-module-3
  -- server
  --- server-module-1
  ---- a
  ---- b
  ---- c
  --- server-module-2
  ---- d
  ---- e
  ---- f
  -- war-module
  </code></pre>
  
  <p>If I manually remove the "war-module" via Maven - "remove project", everything goes back to normal. However, since many people use this project we do not want this to happen to everyone all the time. IntelliJ seems to decide at random if it detects the war-module as a Maven module or not.</p>
  
  <p>Any idea how I can stop IntelliJ from creating this "and modules" structure? I produces a number of weird side effects like opening folders if I expand it in another branch and is very uncomfortable to use.</p>