Maven打包时排除某些文件
2018-01-08 17:14
471 查看
需求:有时会打不同环境的包,如测试、正式等;有时会要排除一些静态资源。
解决:使用maven-war-plugin插件加warSourceExcludes和packagingExcludes这两个参数来配置。这两个参数的官网解释如下:
warSourceExcludes:The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
解释:warSourceDirectory是maven工程的src\main\webapp目录,warSourceExcludes参数决定不将哪些src\main\webapp目录下的文件copy到webappDirectory(一般是工程的target\${warName}目录)。
packagingExcludes:The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement the skinny WAR use case. Note that you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression %regex[]. Hint: read the about (?!Pattern).
解释:在生成webappDirectory(一般是工程的target\${warName}目录)后,要将该目录打包成.war后缀的压缩文件,packagingExcludes参数决定不将哪些webappDirectory目录中的文件打到war包中。
总结:两个参数是在不同阶段起作用的,需要注意的是warSourceExcludes只能排除src\main\webapp目录下的文件。
解决:使用maven-war-plugin插件加warSourceExcludes和packagingExcludes这两个参数来配置。这两个参数的官网解释如下:
warSourceExcludes:The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
解释:warSourceDirectory是maven工程的src\main\webapp目录,warSourceExcludes参数决定不将哪些src\main\webapp目录下的文件copy到webappDirectory(一般是工程的target\${warName}目录)。
packagingExcludes:The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement the skinny WAR use case. Note that you can use the Java Regular Expressions engine to include and exclude specific pattern using the expression %regex[]. Hint: read the about (?!Pattern).
解释:在生成webappDirectory(一般是工程的target\${warName}目录)后,要将该目录打包成.war后缀的压缩文件,packagingExcludes参数决定不将哪些webappDirectory目录中的文件打到war包中。
总结:两个参数是在不同阶段起作用的,需要注意的是warSourceExcludes只能排除src\main\webapp目录下的文件。
相关文章推荐
- Maven打包排除不需要的文件。
- maven 打包排除指定文件
- linux tar 打包排除某些文件、文件夹
- Maven 打包时排除不想打包的文件&跳过测试
- 使用maven-assembly-plugin打包,assembly的语法介绍(同时打多个包、排除依赖包、文件更改别名、自定义路径)
- maven 打包时不包含某些配置文件
- maven打包排除排除指定文件(war,jar)
- maven打包排除指定文件(jar包)
- Maven 打包时排除不想打包的文件&跳过测试
- maven打包时过滤文件及排除依赖包
- maven 打包排除指定文件
- maven打包时过滤文件及排除依赖包
- maven打包排除指定文件(jar包)
- maven-jar-plugin排除不想打包的目录文件内容
- AIX上打包排除某些文件/文件夹
- Maven 打包时排除不想打包的文件&跳过测试
- Maven打包pom里面配置exclude 排除掉环境相关的配置文件
- 全网都找不到的maven-jar-plugin怎么排除不想打包的目录文件内容
- Maven -- 在进行war打包时排除不需要的文件
- maven打包排除部分文件