maven 各种插件要想用好还真是个技术活儿,不像ant那么方面,下面是我的模版
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>**/spy.properties,scripts/ext4/docs/**,scripts/ext4/examples/**,scripts/ext4/pkgs/**,scripts/ext4/src/**,scripts/ext4/welcome/**,
scripts/jquery-ui/development-bundle/**,scripts/jquery-ui/extra/**,
scripts/jqgrid/src/**,scripts/jqgrid/plugins/**,
scripts/colorbox/example*/**,
scripts/jquery-fancybox/example/**,
scripts/masonry/doc/**,
scripts/poshytip/demo/**,
scripts/zTree/demo/**,
logs/**
</packagingExcludes>
<warSourceExcludes>
scripts/ext4/docs/**,scripts/ext4/examples/**,scripts/ext4/pkgs/**,scripts/ext4/src/**,scripts/ext4/welcome/**,
scripts/jquery-ui/development-bundle/**,scripts/jquery-ui/extra/**,
scripts/jqgrid/src/**,scripts/jqgrid/plugins/**,
scripts/colorbox/example*/**,
scripts/jquery-fancybox/example/**,
scripts/masonry/doc/**,
scripts/poshytip/demo/**,
scripts/zTree/demo/**,
logs/**
</warSourceExcludes>
<warSourceDirectory>WebContent</warSourceDirectory>
<workDirectory>${project.build.directory}/work</workDirectory>
<useCache>false</useCache>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
<webXml>${basedir}/WebContent/WEB-INF/web.xml</webXml>
<ignoreWebxml>false</ignoreWebxml>
<warName>${project.build.finalName}</warName>
<finalName>${project.build.finalName}</finalName>
<webResources>
<resource>
<directory>WebContent/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
这个可以正确打包,最后有个问题,默认maven war插件不会打包webapp下的空目录,google 之,发现没有好方法,最后发现,随便在空目录里放一个文件,maven 插件就会打包进去了,great idea!!
本文介绍如何使用Maven插件正确配置并解决空目录打包问题,通过实例展示配置细节,并提供解决默认插件不打包空目录的方法。

被折叠的 条评论
为什么被折叠?



