这里会显示出您选择的修订版和当前版本之间的差别。
后一修订版 | 前一修订版 | ||
分享:技术:maven:maven_resources_plugin [2015/07/13 16:40] gxx 创建 |
分享:技术:maven:maven_resources_plugin [2015/07/13 16:45] (当前版本) gxx |
||
---|---|---|---|
行 1: | 行 1: | ||
====== maven-resources-plugin插件介绍和使用 ====== | ====== maven-resources-plugin插件介绍和使用 ====== | ||
===== maven-resources-plugin插件介绍 ===== | ===== maven-resources-plugin插件介绍 ===== | ||
+ | maven构建项目默认不会拷贝xml和properties文件,只会编译java文件成class文件并拷贝到target目录下,所以需要maven-resources-plugin插件来拷贝相关资源 | ||
===== maven-resources-plugin插件使用 ===== | ===== maven-resources-plugin插件使用 ===== | ||
- | |||
<code xml> | <code xml> | ||
<plugins> | <plugins> | ||
行 37: | 行 36: | ||
</plugin> | </plugin> | ||
</plugins> | </plugins> | ||
+ | <!-- 拷贝资源 --> | ||
+ | <resources> | ||
+ | <resource> | ||
+ | <directory>src/main/resources</directory> | ||
+ | <filtering>true</filtering> | ||
+ | <excludes> | ||
+ | <exclude>**/application-${deploy.environment.exclude}-profile.xml</exclude> | ||
+ | </excludes> | ||
+ | </resource> | ||
+ | <resource> | ||
+ | <directory>src/main/java</directory> | ||
+ | <includes> | ||
+ | <include>**</include> | ||
+ | </includes> | ||
+ | <excludes> | ||
+ | <exclude>**/*.java</exclude> | ||
+ | </excludes> | ||
+ | </resource> | ||
+ | </resources> | ||
+ | |||
+ | <testResources> | ||
+ | <testResource> | ||
+ | <directory>src/test/resources</directory> | ||
+ | <filtering>true</filtering> | ||
+ | </testResource> | ||
+ | </testResources> | ||
</code> | </code> |