maven处理资源文件

来源:互联网 发布:列车网络控制系统 编辑:程序博客网 时间:2024/06/14 23:49

有时候我们可能要过滤web资源,一般的资源的过滤使用maven-resouce


<!--资源文件  detail: http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html --><plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration>     <filters>         <filter>src/main/webapp/filters/resource-filter.properties</filter>     </filters>     <resources>         <resource>             <directory>src/main/resources</directory>             <filtering>true</filtering>         </resource>     </resources> </configuration></plugin>

web资源的处理:

<!--web资源文件  detail: https://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html --><plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration>    <webResources>        <resource>            <!-- this is relative to the pom.xml directory -->            <directory>src/main/webapp</directory>            <include>**/*.jsp</include>            <filtering>true</filtering>        </resource>    </webResources> </configuration></plugin>

注意:

web资源和一般的资源的区别,web资源是在webapp目录下的资源(默认的情况下);

0 0
原创粉丝点击