我有一個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