我有一个Java web应用程序,其中我有一些文件夹内的标准webapp源目录(src/main/webapp)
,我不想复制到战争(exploded
或packaged
)。如何排除文件被maven复制到爆炸战中
我不希望这些文件复制的原因之一是我们在爆炸战争中的.js和.css文件上运行YUI JS & CSS极小化器&压缩器。我想要排除的文件在压缩阶段会产生错误。我不希望他们加入战争的另一个原因是他们支持测试Web应用程序中的单页JS应用程序(它们是依赖于node
/angular.js
的客户端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>
我都试过了,没有成功,使用warSourceExcludes
排除某些路径,但无济于事。我使用的示例如下所示,其中client/
是直接在文件夹src/main/webapp
下:
<configuration>
...
<warSourceExcludes>
<excludes>
<exclude>
client/
</exclude>
</excludes>
</warSourceExcludes>
...
</configuration>
什么是排除某些路径的正确途径,或单个文件,Web应用程序源目录中被列入爆炸的战争?
UPDATE
从@maba我更新了配置如下建议继:
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<overlays>
</overlays>
<webappDirectory>${project.build.directory}/${project.build.finalName}-work</webappDirectory>
<warSourceExcludes>client/</warSourceExcludes>
</configuration>
的文件夹,client/
,仍然得到跨越复制。有任何想法吗?
warSourceExcludes被记录为一个逗号分隔的字符串,所以不应该在没有任何XML 。 http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html –
问题已更新,以反映正确的使用 - 但仍然不适用于我。 – Kris
我怀疑我的'pom.xml'还有一个问题。我会考虑是否这几周原始项目从原型 – Kris