我有一个Java Web应用程序,其中我在标准webapp源目录(src/main/webapp)中有一些文件夹,我不想被复制到war(exploded或packaged)中.
我不希望这些文件复制的原因之一是我们在爆炸战争中的.js和.css文件上运行YUI JS&CSS最小化器和压缩器.我想要排除的文件在压缩阶段产生错误.我不希望他们加入战争的另一个原因是他们支持测试位于webapp中的单页JS应用程序(它们是依赖于node/的客户端JS测试脚本angular.js).
以下是相关部分POM.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>parent-resources</id>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<overlays>
</overlays>
<webappDirectory>${project.build.directory}/${project.build.finalName}-work</webappDirectory>
</configuration>
<phase>generate-sources</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我尝试过,warSourceExcludes但未成功地使用它来排除某些路径,但无济于事.我的用法示例如下所示,其中client/是直接位于下方的文件夹src/main/webapp:
<configuration>
...
<warSourceExcludes>
<excludes>
<exclude>
client/
</exclude>
</excludes>
</warSourceExcludes>
...
</configuration>
Run Code Online (Sandbox Code Playgroud)
将Web应用程序源目录中的某些路径和/或单个文件排除在爆炸战争中的正确方法是什么?
根据@maba的建议,我更新了配置如下:
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<overlays>
</overlays>
<webappDirectory>${project.build.directory}/${project.build.finalName}-work</webappDirectory>
<warSourceExcludes>client/</warSourceExcludes>
</configuration>
Run Code Online (Sandbox Code Playgroud)
该文件夹client/仍然被复制.有任何想法吗?