2016-09-18 52 views
0

縮小後,我有這樣的webapp內容:Maven的WAR插件 - 改變前端資源的位置

WEB-INF 
assets 
favicon 
i18n 
scripts 
dist 
index.html 
//other things 

凡內dist我已經壓縮樣式,腳本等......但Maven WAR plugin副本一切戰爭,這導致WAR包含未定義的來源。我試圖更改目錄webResources

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>${maven-war-plugin.version}</version> 
    <configuration> 
     <failOnMissingWebXml>false</failOnMissingWebXml> 
     packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes> 
     <webResources> 
      <resource> 
       <filtering>true</filtering> 
       <directory>src/main/webapp/dist</directory> 
       <includes> 
        <include>**/*.xml</include> 
       </includes> 
      </resource> 
     </webResources> 
    </configuration> 
</plugin> 

但沒有任何改變。誰能幫我這個?預先感謝您的每一個答案。

回答

1

packagingExcludes接受逗號分隔的不包含的資源列表。將所有目錄添加到它,您想要排除,例如

<packagingExcludes> 
    WEB-INF/lib/tomcat-*.jar, 
    scripts 
</packagingExcludes> 

您還需要確保資源不包含在maven資源插件中。

我不推薦手動處理所有的排除,我建議將所有不想在war文件中出現的文件移出目錄,默認情況下默認包含資源。你可以將它們移動到例如的src/main/uncompressedResources。這樣他們仍然在項目中,但默認情況下,maven不會包含它們。