title: Eclipse + Maven + Dynamic Web Project -> Maven overwrites Deployment Assembly
body: <p><strong>Summary</strong></p>
  
  <p>In Eclipse, when I "Maven->Update Project Configuration" "Maven Dependencies" gets removed from the "Deployment Assembly" of my project.</p>
  
  <p><strong>Details</strong></p>
  
  <p>I started with a pre-configured Eclipse project: File->New->Dynamic Web Project->JavaServer Face v2.0 Project. To remove the "magic" I then converted it to a Maven project: Configure->Convert to Maven project.</p>
  
  <p>pom.xml contains the following:</p>
  
  <pre><code>&lt;build&gt;
      &lt;finalName&gt;jsf-facelets-tutorial&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;webXml&gt;WebContent/WEB-INF/web.xml&lt;/webXml&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.el&lt;/groupId&gt;
          &lt;artifactId&gt;el-api&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.myfaces.core&lt;/groupId&gt;
          &lt;artifactId&gt;myfaces-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.5&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.myfaces.core&lt;/groupId&gt;
          &lt;artifactId&gt;myfaces-impl&lt;/artifactId&gt;
          &lt;version&gt;2.0.5&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Then, to make sure the Maven dependencies are copied to "WEB-INF/lib/" before deploying, 
  I added them to the project's "Deployment Assembly": Project Properties->Deployment Assembly. For more details, see this question: <a href="https://stackoverflow.com/questions/9973599/eclipse-maven-javaserver-faces-classnotfoundexception-startupservletcont">Eclipse + Maven + JavaServer Faces -&gt; ClassNotFoundException: StartupServletContextListener</a>.</p>
  
  <p>I know have two related problems.</p>
  
  <p><strong>Problems</strong></p>
  
  <p><strong>(1)</strong> When I "Project->Maven->Update Project Configuration", "Maven Dependencies" gets removed from my "Deployment Assembly". Is there a way to stop this from happening, possibly via some Maven plugin?</p>
  
  <p><strong>(2)</strong> When I build the .war from within Eclipse everything is fine, the .war runs fine in Tomcat. But when I build it from command line with Maven, <code>mvn clean compile war:war</code>, the .html files from "WebContent/" is not added to the .war. Again, Which Maven settings/plugins do I need to remedy this?</p>
  
  <p>FYI, it's a very basic application... just a login page and a welcome page.</p>
  
  <p>If there are any additional details I should provide (web.xml, faces-config-xml, login.xhtml), let me know and I'll add them.</p>
  
  <p>Thanks</p>
  
  <p><strong>--EDIT--</strong></p>
  
  <p>Eclipse version: 3.6.2 </p>
  
  <p>Eclipse m2e version: 1.0.1 </p>
  
  <p>Apache Maven version: 2.2.1</p>
  
  <p><strong>(1) Solution</strong></p>
  
  <p>Updated to Eclipse Java EE 3.7.2 (Indigo). Now also using <a href="http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/" rel="nofollow noreferrer">m2e-wtp Maven Integration for Eclipse WTP plugin</a></p>
  
  <p><strong>(2) Solution</strong></p>
  
  <p>Created new Maven project from <a href="http://myfaces.apache.org/build-tools/archetypes/myfaces-archetype-helloworld20/index.html" rel="nofollow noreferrer">archetype</a>, then Eclipse->Import->Existing Maven Project. With new Eclipse version and the m2e-wtp, the Java EE perspective in Eclipse works well with the standard Maven directory structure</p>
  
  <p>The pom.xml is now simpler too:</p>
  
  <pre><code>&lt;build&gt;
      &lt;finalName&gt;jsf-facelets-tutorial&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.el&lt;/groupId&gt;
          &lt;artifactId&gt;el-api&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.myfaces.core&lt;/groupId&gt;
          &lt;artifactId&gt;myfaces-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.5&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.myfaces.core&lt;/groupId&gt;
          &lt;artifactId&gt;myfaces-impl&lt;/artifactId&gt;
          &lt;version&gt;2.0.5&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>