If someone wants total control over the path of the source and destination paths, then using maven-antrun-plugin
's copy
task is the best option. This approach will allow you to copy between any paths on the system, irrespective of the concerned paths being within the mvn
project or not. I had a situation where I had to do some unusual stuff like copy generated source files from target
directory back to the src
directory for further processing. In my situation, this was the only option that worked without fuss. Sample code snippet from pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy file="${basedir}/target/myome/minifyJsSrcDir/myome.min.js" todir="${basedir}/src/main/webapp/app/minifyJsSrcDir"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>