过滤掉class文件和jar包,包含和过滤掉特定的jsp文件
maven-war-plugin插件介绍:http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.1.0</version> <configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml> <packagingExcludes>WEB-INF/classes/,WEB-INF/lib/</packagingExcludes> <warSourceExcludes>WEB-INF/view/hello.jsp</warSourceExcludes> <warSourceIncludes>WEB-INF/view/index.jsp</warSourceIncludes> </configuration> <executions> <execution> <id>prepare-war</id> <phase>prepare-package</phase> <goals> <goal>exploded</goal> </goals> </execution> </executions> </plugin>
添加<webXml>src/main/webapp/WEB-INF/web.xml</webXml>是因为打包时报错:
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)