title: Maven: generating a WAR of the whole project, and a JAR of a specific package
body: <p>I develop a webapp using a model-view-controller pattern. The <code>model</code> package represents the core API of the application, that could be used independently. The <code>controller</code> and <code>view</code> packages use the <code>model</code> package to produce a webapp. </p>
  
  <p><strong>Question:</strong> 
  I'd like to be able to build a JAR of only the <code>model</code> package, and a WAR of the three packages. And I'd like to keep the three packages in a same project. The webapp WAR would include supplementary libraries as compared to the standalone JAR.
  How could I achieve this with Maven? Would there be a solution using for instance two separate pom.xml files? (because as far as I know, you cannot choose two <code>packaging</code> options in the pom.xml)</p>
  
  <p>(I've seen <a href="https://stackoverflow.com/questions/12576767/how-to-create-a-jar-from-part-of-my-project-that-is-packaged-as-a-war">this question</a>, but I really want my three packages to be part of a same project, and be part of the same directory.) </p>
  
  <p>Also, my project uses a classical webapp structure (simplified here): </p>
  
  <pre><code>my-app
  -- pom.xml
  -- src
  ----- main/
  -------- java/
  ----------- model/
  ----------- view/
  ----------- controller/
  -------- webapp/
  ---------- WEB-INF/
  -------------classes/
  </code></pre>
  
  <p>Could I manage to generate the JAR in the classical <code>target/</code> directory, and the webapp in the classical <code>src/main/webapp/</code> directory? (and, as asked, including different libraries)</p>
  
  <p>Thanks for your help.</p>