title: Share test resources between maven projects
body: <p>There is a clear solution for sharing the common test code between maven projects using <code>test-jar</code> goal of <code>maven-jar-plugin</code> plugin (see <a href="https://stackoverflow.com/questions/174560/sharing-test-code-in-maven">here</a>).</p>
  
  <p>I need to do the similar thing with test resources, in particular, I want test resources of project A be available in the classpath of project B during testing.</p>
  
  <p>For project A one need to declare:</p>
  
  <pre><code>&lt;!-- Package and attach test resources to the list of artifacts: --&gt;
  &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;tasks&gt;
                      &lt;jar destfile="${project.build.directory}/test-resources.jar"&gt;
                          &lt;fileset dir="${project.basedir}/test-resources" /&gt;
                      &lt;/jar&gt;
                  &lt;/tasks&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;package&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;attach-artifact&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;artifacts&gt;
                      &lt;artifact&gt;
                          &lt;file&gt;${project.build.directory}/test-resources.jar&lt;/file&gt;
                          &lt;type&gt;jar&lt;/type&gt;
                          &lt;classifier&gt;test-resources&lt;/classifier&gt;
                      &lt;/artifact&gt;
                  &lt;/artifacts&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>And in project B it will be normal dependency:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;myproject.groupId&lt;/groupId&gt;
      &lt;artifactId&gt;myartifact&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;classifier&gt;test-resources&lt;/classifier&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Question: Should it work in all cases? Is it possible to pack resources without <code>maven-antrun-plugin</code> (using more 'lightweight' plugin)?</p>