2011-05-13 114 views
8

現在,這是徹頭徹尾的怪異:我有很多的文件夾/文件我想複製到我的抗戰,這裏的POM的相關部分:maven WAR插件跳過資源?

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <webResources> 
     <resource><directory>../common-web-content/src/main/resources</directory></resource> 
     <resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource> 
     <resource><directory>../common-presentation/src/main/webapp</directory></resource> 
     <resource> 
      <directory>${project.basedir}/src/main/webapp/WEB-INF</directory> 
      <includes><include>web.xml</include></includes> 
      <filtering>true</filtering> 
      <targetPath>WEB-INF</targetPath> 
     </resource> 
     </webResources> 
    </configuration> 
</plugin> 

的路徑是正確的,並再次檢查。但是,第二個資源文件夾不被複制 - 在這種情況下,pqm-web-content,但即使我改變序列,它總是第二個缺失。但沒有錯誤消息:

[INFO] Processing war project 
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../common-web-content/src/main/resources] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT] 
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../pqm-web-content/src/main/resources] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT] 
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war\../common-presentation/src/main/webapp] to[D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT] 
[INFO] Copy webapp webResources[D:\pqmGF\pqm\pqm-war/src/main/webapp/WEB-INF] to [D:\pqmGF\pqm\pqm-war\target\pqm-war-3.3.5.0-SNAPSHOT] 
[INFO] Webapp assembled in[7891 msecs] 
+0

您是否嘗試刪除fitering標籤? – Javabeginner 2011-05-16 08:58:07

+0

是的 - 沒有區別 – 2011-05-16 10:06:40

回答

2

顯然,這是的Maven或Maven 3.0.3和WAR插件之間的不兼容錯誤。切換到Maven 2.2.1後,它可以正常工作。

+2

我做了一個Maven-WAR JIRA的快速搜索,沒有看到任何看起來像這樣的東西。您可能想提出問題,以便正確的人員看到問題並解決問題。 – vkraemer 2011-05-24 14:08:00

1

你有沒有考慮做這樣的事情......

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <webResources> 
     <resource><directory>../common-web-content/src/main/resources</directory></resource> 
     <!-- this next line is repeated because of a problem I am having with the maven-war-plugin --> 
     <resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource> 
     <resource><directory>../pqm-web-content/src/main/resources</directory><filtering>true</filtering></resource> 
     <resource><directory>../common-presentation/src/main/webapp</directory></resource> 
     <resource> 
      <directory>${project.basedir}/src/main/webapp/WEB-INF</directory> 
      <includes><include>web.xml</include></includes> 
      <filtering>true</filtering> 
      <targetPath>WEB-INF</targetPath> 
     </resource> 
     </webResources> 
    </configuration> 
</plugin> 
+0

我會接受這種創造力,儘管由於某種原因,原來的問題已經消失,所以我不能說它是否能解決問題。 – 2011-05-23 08:25:25

0

我從maven-war-plugin version 2.6有類似的問題,當從兩個連續的目錄,第一個的內容不會被複制到最終構建。 問題是我在單個<resource>標記中有兩個<directory>標記。單個<resource>單個<directory>標記正常工作。