2009-10-30 144 views
1

我按照指示here,它的工作,但只有它被映射到一個目錄以外的默認。如何使用maven war插件從目標目錄中排除文件/目錄?

下面是我試過的例子:

<configuration> 
    <webResources> 
      <resource> 
       <directory>${basedir}/src/main/webapp/WEB-INF</directory> 
       <!-- the below works when uncommented and does exclude *.tmp --> 
       <!-- <targetPath>test/WEB-INF</targetPath> --> 
       <!-- the below does not --> 
       <targetPath>WEB-INF</targetPath> 
       <excludes> 
       <exclude>*.tmp</exclude> 
       </excludes> 
      </resource> 
     </webResources> 
</configuration> 

所以我的假設是,我有別的東西覆蓋了配置。不過,這是我使用maven的第一個項目,所以我不確定接下來要測試或調查什麼。

回答

1

你排斥改變

**/*.tmp 

你也可以從目錄中留下關閉WEB-INF和完全消除targetdirectory中。例如,這裏包含所有xml,xhtml,x * ml等,並排除任何目錄中的所有* .tmp。

<webResources> 
    <resource> 
     <directory>${basedir}/src/main/webapp</directory> 
     <includes> 
      <include>**/*.x*ml</include> 
     </includes> 
     <excludes> 
      <exclude>**/*.tmp</exclude> 
     </excludes> 
    </resource> 
</webResources>