Normally, my POM file is working fine and all unit tests pass and all artifacts are packaged properly. However, once I've added this maven-resources-plugin to create specific configuration depending upon profile all my tests fail because nothing in 'src/test/resources' is copied to 'test-classes':
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.build.directory}/${config.dir}/${project.activeProfiles[1].id}</outputDirectory>
<resources>
<filtering>true</filtering>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</configuration>
</plugin>
I don't understand why this would block the copying of test resources. Any ideas?
After much trial and error, I came to a solution. The maven-resources-plugin needed to be attached to the process-resources phase in order for everything to resolve as expected. Now, this may not be the best answer, but it worked for me. Let me know if you have a better solution.
<executions>
<execution>
<id>create specific server configuration</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
/** as above **/
</configuration>
</execution>
</executions>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With