title: Maven JAR module depends on classes in WAR
body: <p>I have an application which is packaged as a .war file. It has GWT code and a set of web-services. </p>
  
  <p>I want to move the web-services code to a separate jar file, so the application can be build without them.</p>
  
  <p><strong>Services depend on code which is currently packaged into .war file, so in pom.xml for jar file I specify the following dependency:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;my.group&lt;/groupId&gt;
      &lt;artifactId&gt;my-war&lt;/artifactId&gt;
      &lt;version&gt;1.0.4&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>But to package the .war archive I also need to specify a dependency for the jar, like this:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;my.group&lt;/groupId&gt;
      &lt;artifactId&gt;my-services-jar&lt;/artifactId&gt;
      &lt;version&gt;1.0.4&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Which results in Circular Dependency.</strong></p>
  
  <p>How do I solve this? Or maybe I should follow a different approach?
  Thanks.</p>