title: How to make maven to take resources from /src/test/resources instead of /src/main/resources for a dependent project?
body: <p>I've searched the forum to find the answer to my problem, but I was unable to find it. My problem is, that:</p>
  
  <p>I have two projects: ProjectA and ProjectB. ProjectB uses ProjectA. In ProjectA i have two folders:
  /src/main/resources and /src/test/resources.
  In ProjectB i run: mvn clean install. I want, that in the test phase, classes in ProjectB use resources from /src/test/resources instead of /src/main/resources.</p>
  
  <p>This is what I tried:
  <a href="http://www.waltercedric.com/java-j2ee-mainmenu-53/361-maven-build-system/1349-maven-reusing-test-classes-across-multi-modules-projects.html" rel="noreferrer">http://www.waltercedric.com/java-j2ee-mainmenu-53/361-maven-build-system/1349-maven-reusing-test-classes-across-multi-modules-projects.html</a></p>
  
  <p>It is similar to my problem, but after I configured the test-jar goal for ProjectA, ProjectB still runs the tests in the way, that classes in ProjectA use properties from /src/main/resources instead of /src/test/resources.</p>
  
  <p>My pom.xml in ProjectA looks like:</p>
  
  <pre><code>&lt;project ...&gt;
      &lt;parent&gt;
          ...
      &lt;/parent&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;ProjectA&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;dependencies&gt;
          ...
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
          &lt;testResources&gt;
              &lt;testResource&gt;
                  &lt;directory&gt;src/test/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/testResource&gt;
          &lt;/testResources&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;test-jar&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>In ProjectB my pom.xml looks like:</p>
  
  <pre><code>&lt;project ...&gt;
      &lt;parent&gt;
          ...
      &lt;/parent&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;ProjectB&lt;/artifactId&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.6&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;integration-test&lt;/goal&gt;
                              &lt;goal&gt;verify&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sensano&lt;/groupId&gt;
              &lt;artifactId&gt;ProjectA&lt;/artifactId&gt;
              &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;ProjectA&lt;/groupId&gt;
              &lt;artifactId&gt;ProjectA&lt;/artifactId&gt;
              &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;type&gt;test-jar&lt;/type&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Is there a method 
  Any help would be appreciated!</p>
  
  <p>Sincerely,<br>
  Mateusz Moroz</p>