You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Waluk <mw...@gmail.com> on 2006/09/01 07:06:31 UTC

Resources not copied for integration-test module?

Hi,

I have setup a module in my project for integration tests.  I based it upon
the example in the Mergere book.  It says to put your test resouces into
src/it/resources, but these don't get copied into target/test-classes
automatically.  I even tried to put a copy in src/test/resources as with
normal tests, but that didn't work either.  I worked around this using Ant
to copy the files myself, but I know I must be missing something obvious
that would make it work automatically.

I tried defining the resources with:

        <testSourceDirectory>src/it</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>src/it/resources</directory>
            </testResource>
        </testResources>

but it didn't make a difference.  Maybe there is an equivalent to
<testResources> for integration tests?

So I have used this:

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>

                <!-- For some reason resources aren't copied automatically.
-->
               <execution>
                  <id>copy-it-resources</id>
                  <phase>process-resources</phase>
                  <configuration>
                     <tasks>
                        <copy todir="${project.build.testOutputDirectory}">
                           <fileset dir="${basedir}/src/it/resources">
                                <include name="*.xml"></include>
                                <include name="*.properties"></include>
                           </fileset>
                        </copy>
                     </tasks>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
              </executions>
            </plugin>

Can anyone tell me how to have files in "src/it/resources" copied to
"target/test-classes" automatically like they are for "src/test/resources"
with normal tests?

Thanks so much,
Michael