Copying multiple resource directories to independent target directories with maven
This is where the file ends up:
<outputDirectory>${basedir}/target/blah</outputDirectory>
This is where it is copied from:
<directory>src/main/otherresources</directory>
There would be an <include>
or <includes>
tag to tell the file name(s)
Multiples
You need multiple <execution>
s with different <id>
s for multiple folders:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources-1</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/blah</outputDirectory>
<resources>
<resource>
<directory>blah</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources-2</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/ughh</outputDirectory>
<resources>
<resource>
<directory>ughh</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
For me this one works well in Maven 3:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>custom-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<targetPath>${basedir}/target/blah</targetPath>
<directory>blah</directory>
<filtering>true</filtering>
</resource>
<resource>
<targetPath>${basedir}/target/uggh</targetPath>
<directory>uggh</directory>
<filtering>false</filtering>
</resource>
<encoding>UTF-8</encoding>
</configuration>
</execution>
</executions>
</plugin>
This is the simpler solution I've found and it's working...
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/java/org/mc2/mymusic/gui/main/Menu/resources</directory>
<targetPath>${basedir}/target/classes/org/mc2/mymusic/gui/main/Menu/resources</targetPath>
<filtering>false</filtering>
</resource>
</resources>
</build>
You can use ant-style patterns
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}</directory>
<includes>
<include>blah/**</include>
<include>uggh/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>