【问题标题】:How do I exclude files/directories from the target directory using the maven war plugin?如何使用 maven war 插件从目标目录中排除文件/目录?
【发布时间】:2010-12-11 17:27:35
【问题描述】:

我按照here 的说明进行操作,但只有在映射到默认目录以外的目录时才有效。

这是我尝试过的一个示例:

<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 的项目,所以我不确定接下来要测试或调查什么。

【问题讨论】:

    标签: maven-2 jetty maven-plugin pom.xml war-filedeployment


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 2019-02-19
      • 1970-01-01
      • 2015-12-13
      • 2016-04-11
      • 2015-03-13
      • 1970-01-01
      • 2013-10-03
      • 2013-10-27
      • 1970-01-01
      相关资源
      最近更新 更多