在项目 pom.xml 中指定
<build>
<resources>
<resource>
<!--控制资源目录下要打包进去的文件,这里为全部打包-->
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<!--细粒度控制-->
<directory>src/main/resources2</directory>
<includes>
<include>**/*.txt</include>
</includes>
<excludes>
<exclude>**/*.jpg</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<useDefaultDelimiters>true</useDefaultDelimiters>
<resources>
<!--指定资源目录-->
<resource>src/main/resources</resource>
<resource>src/main/resources2</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html