2011-09-30 91 views
2

正如我所收集的,maven-war-plugin絕不會覆蓋已經存在於覆蓋目標中的文件。舉例來說,如果我有一個war一個這對一個war的依賴關係,這兩者包含位於src/main/resources/some.xml一些資源,產生的A.war將包含來自一個項目some.xml在maven戰爭覆蓋期間覆蓋資源

如何指導maven-war-plugin在原有的(一個)有利於從依賴()的資源?

+1

是否有一個原因,你不能從A刪除重複的文件? –

+0

我同意@MaxNanasy。應該使用疊加層來爲WAR定義模板。 – TheAmpersand

回答

0

您可以使用maven-resources插件將文件複製到所需位置。戰前或戰後已建成。

1

http://maven.apache.org/plugins/maven-war-plugin/overlays.html

「舉例來說,如果覆蓋的index.jsp文件我-web應用必須在webapp進行設置,但其他文件可以控制的常規方式,定義了兩個對於我-web應用

<groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.3</version> 
    <configuration> 
     <overlays> 
     <overlay> 
      <id>my-webapp-index.jsp</id> 
      <groupId>com.example.projects</groupId> 
      <artifactId>my-webapp</artifactId> 
      <includes> 
      <include>index.jsp</include> 
      </includes> 
     </overlay> 
     <overlay> 
      <!-- empty groupId/artifactId represents the current build --> 
     </overlay> 
     ... 
     </overlays> 
    </configuration> 

想這是不是最終d覆蓋配置esicion,但這是一個開始。