title: Sharing Java packages between modules in IntelliJ?
body: <p>I'm trying to figure out how can I share packages between two modules in a single IntelliJ project, and I can't seem to find the right way to do it. I know it can be done in Eclipse, but I'm not very well-versed with it. In a nutshell, I'm trying to reproduce the same kind of project environment created by AppEngine-connected Android projects.</p>
  
  <p>Here's the "problem" as best I can lay it out</p>
  
  <p>Project A.</p>
  
  <ul>
  <li>Module 1; AppEngine + GWT + whatever else</li>
  <li>Module 2; Android</li>
  </ul>
  
  <p>Each module has its own source directory within the Project's main directory:</p>
  
  <ul>
  <li>/ProjectA/Module1/src</li>
  <li>/ProjectA/Module2/src</li>
  </ul>
  
  <p>I create packages for both modules, and write the various classes needed for each. Most classes are unique to the module / platform, and are packaged into their own namespace</p>
  
  <p>Module 1</p>
  
  <ul>
  <li>com.example.myproject.server</li>
  <li>com.example.myproject.server.domain</li>
  <li>com.example.myproject.server.services</li>
  <li>...</li>
  </ul>
  
  <p>Module 2</p>
  
  <ul>
  <li>com.example.myproject.client </li>
  <li>com.example.myproject.client.activities</li>
  <li>com.example.myproject.client.fragments</li>
  <li>...</li>
  </ul>
  
  <p>However, there are some identical Interfaces and Enums that I use within both modules: Now I'd like to have all my identical code in a single package shared between the two, so I don't have to copy the source between packages every time I change something around.</p>
  
  <ul>
  <li>com.example.myproject.shared</li>
  <li>com.example.myproject.shared.interfaces</li>
  <li>...</li>
  </ul>
  
  <p>I know IntelliJ will allow you to configure multiple content Roots as part of a module's configuration. But it doesn't seem that two modules care share the same content root if their part of the same IntelliJ Project...? Is there a better way to configure my project? Or am I missing something..?</p>