2011-05-12 57 views
1

這個maven文檔必須是錯誤的。使用戰爭排除在pom.xml

這裏有我有全都未能排除的文件試過各種排列:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <warSourceExcludes>**/*server.properties</warSourceExcludes> 
    </configuration> 
    </plugin> 

    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <webResources> 
     <resource> 
      <!-- this is relative to the pom.xml directory --> 
      <directory>src/main/resources/com/mycom/myapplication/</directory> 
      <!-- there's no default value for this --> 
      <excludes> 
      <exclude>**/*server.properties</exclude> 
      </excludes> 
     </resource> 
     </webResources> 
    </configuration> 
    </plugin> 

一個郵件列表項建議使用此舊版本和一個字符串列表:

<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.0.1</version> 
    <configuration> 
     <webResources> 
     <resource> 
      <!-- this is relative to the pom.xml directory --> 
      <directory>src/main/resources/com/pictage/provendirect/</directory> 
      <!-- there's no default value for this --> 
      <excludes>**/*server.properties</excludes> 
     </resource> 
     </webResources> 
    </configuration> 
    </plugin> 

導致在:

(找到靜態表達式:'/* server.properties'可能作爲默認值)。 原因:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.0.1</version> 
    <configuration> 
     <packagingExcludes> 
     **/server.properties 
     </packagingExcludes> 
    </configuration> 
    </plugin> 
:不能從「
/*server.properties」,這是類型類java.lang.String的

還試圖分配配置條目「不包括」到「接口java.util.List中」

有沒有想法?我瘋了。

回答

0

甲行家文檔的更仔細的閱讀表明:

<configuration> 
    <webResources> 
    <resource> 

應該僅排除外部資源/ SRC /主/資源時使用。要在此文件夾中執行此操作,如果屬性不在目錄的根目錄中,則需要使用warSourceExcludes和可能的warSourceDirectory參數。

當我需要花費幾個小時的時間通過Maven配置來完成某些工作時,我可能會用一種腳本語言在兩秒內處理它,但我想這是實現它的「正確」方法。