2011-05-12 41 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配置来完成某些工作时,我可能会用一种脚本语言在两秒内处理它,但我想这是实现它的“正确”方法。