Copy files using maven plugin
In the development of the project using maven, sometimes you need to copy files in different directories depending on the environment when packaging is usually configuration files.
Providing apache maven-resources-plugin copy files can be copied at a specified maven life cycle, an example configuration
<project>
...
<build>
<plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <!-- here the phase you need --> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/extra-resources</outputDirectory> <resources> <resource> <directory>src/non-packaged-resources</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ...