In my project I have created the following directory structure
src
-> main
-> java
-> resources
-> test
-> java
-> resources
-> integration-test
-> java
-> resources
In my pom.xml I have made following entry
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<configuration>
<testSourceDirectory>src/integration-test/java</testSourceDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
If i copy a resource in the src->test->resources it is copied successfully to /target/test-classes automatically. But if I copy a file into /src/integration-test/resources then it is not copied into the target/test-classes at build time.
How can I make the integration test also copy the files inside the resource into the target?
The integration-test
goal of the maven-failsafe-plugin in by default bound to the integration-test
lifecycle phase: http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html. Therefore, since the integration-test
phase comes way after the process-test-sources
[1] (during which test sources are usually copied to the target
directory) and because I assume what your are referring to by by "build time" is actually the Eclipse "Automatic build" feature, your integration test sources are not copied because Eclipse build stops at the test-compile
lifecycle phase.
You should check out Maven lifecycle and how to map certains goal to lifecycle phases that fit your needs.
[1] https://maven.apache.org/ref/3.3.9/maven-core/lifecycles.html