title: Maven does not copy spring jars in WEB-INF/lib folder
body: <p>I have a multi module maven project : <code>parent-proj</code> which two submodules : <code>child-dao-proj</code> and <code>child-web-proj</code>. <code>child-dao-proj</code> is a  maven java project while <code>child-web-proj</code> is a web project. 
  In the pom parent project, I declared all the required dependencies needed by both :</p>
  
  <pre><code> &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;fr.myproject&lt;/groupId&gt;
  &lt;artifactId&gt;parent-proj&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;modules&gt;
      &lt;module&gt;child-dao-proj&lt;/module&gt;
      &lt;module&gt;child-web-proj&lt;/module&gt;
  &lt;/modules&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  
   &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;!--Spring dependencies--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
              &lt;version&gt;${spring.data.jpa}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-commons&lt;/artifactId&gt;
              &lt;version&gt;1.8.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate Jars --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.1.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Mysql connector--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.31&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;version&gt;1.4.180&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.GA&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Test dependencies--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.assertj&lt;/groupId&gt;
              &lt;artifactId&gt;assertj-core&lt;/artifactId&gt;
              &lt;version&gt;1.6.1&lt;/version&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.11&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
              &lt;artifactId&gt;hamcrest-all&lt;/artifactId&gt;
              &lt;version&gt;1.3&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  </code></pre>
  
  <p>I put all needed dependencies for the persistence jars (hibernate, spring-orm, spring-data, etc) in <code>child-dao-proj</code> and all the web jars (spring-mvc, spring-web, etc) for <code>child-web-proj</code>. </p>
  
  <p>When I run mvn clean install and deploy the web project in Tomcat, I am stuck with this error : <code>java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener</code>.</p>
  
  <p>After searching, it seems that the spring jars are not copied in the <code>WEB-INF/lib</code> directory.</p>
  
  <p>Anyone know how can I resolve this issue? </p>
  
  <p>[EDIT] Here the pom for the web project : </p>
  
  <pre><code>&lt;parent&gt;
      &lt;artifactId&gt;parent-proj&lt;/artifactId&gt;
      &lt;groupId&gt;fr.myproject&lt;/groupId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;artifactId&gt;child-web-proj&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;fr.myproject.dao&lt;/groupId&gt;
          &lt;artifactId&gt;child-dao-proj&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.assertj&lt;/groupId&gt;
          &lt;artifactId&gt;assertj-core&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I forgot to mention that I am working with Intellij. </p>
  
  <p>[EDIT] Here is the output of <code>mvn dependency:tree</code> :</p>
  
  <pre><code>[INFO] ------------------------------------------------------------------------
  [INFO] Building child-web-proj Maven Webapp 1.0-SNAPSHOT
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ child-web-proj ---
  [INFO] fr.myproject:child-web-proj:war:1.0-SNAPSHOT
  [INFO] +- fr.myproject:child-dao-proj:jar:1.0-SNAPSHOT:compile
  [INFO] |  +- org.springframework:spring-orm:jar:4.0.6.RELEASE:compile
  [INFO] |  |  +- org.springframework:spring-jdbc:jar:4.0.6.RELEASE:compile
  [INFO] |  |  \- org.springframework:spring-tx:jar:4.0.6.RELEASE:compile
  [INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.6.1.RELEASE:compile
  [INFO] |  |  +- org.aspectj:aspectjrt:jar:1.8.0:compile
  [INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.7:compile
  [INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.7:runtime
  [INFO] |  +- org.springframework.data:spring-data-commons:jar:1.8.1.RELEASE:compile
  [INFO] |  +- org.hibernate:hibernate-entitymanager:jar:4.3.6.Final:compile
  [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
  [INFO] |  |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
  [INFO] |  |  +- org.hibernate:hibernate-core:jar:4.3.6.Final:compile
  [INFO] |  |  |  +- antlr:antlr:jar:2.7.7:compile
  [INFO] |  |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
  [INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
  [INFO] |  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
  [INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
  [INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
  [INFO] |  |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
  [INFO] |  |  \- org.javassist:javassist:jar:3.18.1-GA:compile
  [INFO] |  +- javax.persistence:persistence-api:jar:1.0.2:compile
  [INFO] |  +- mysql:mysql-connector-java:jar:5.1.31:compile
  [INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:compile
  [INFO] +- org.springframework:spring-web:jar:4.0.6.RELEASE:compile
  [INFO] |  +- org.springframework:spring-aop:jar:4.0.6.RELEASE:compile
  [INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
  [INFO] |  +- org.springframework:spring-beans:jar:4.0.6.RELEASE:compile
  [INFO] |  +- org.springframework:spring-context:jar:4.0.6.RELEASE:compile
  [INFO] |  \- org.springframework:spring-core:jar:4.0.6.RELEASE:compile
  [INFO] |     \- commons-logging:commons-logging:jar:1.1.3:compile
  [INFO] +- org.springframework:spring-webmvc:jar:4.0.6.RELEASE:compile
  [INFO] |  \- org.springframework:spring-expression:jar:4.0.6.RELEASE:compile
  [INFO] +- org.springframework:spring-test:jar:4.0.6.RELEASE:compile
  [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
  [INFO] +- junit:junit:jar:4.11:test
  [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
  [INFO] +- com.h2database:h2:jar:1.4.180:test
  [INFO] \- org.assertj:assertj-core:jar:1.6.1:test
  [INFO] ------------------------------------------------------------------------
  </code></pre>