通过Maven创建zip文件时如何排除某些文件夹 [英] How to exclude some of the folders while creating zip file through maven

查看:346
本文介绍了通过Maven创建zip文件时如何排除某些文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembl/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>bin</id>
    <baseDirectory>/</baseDirectory>
    <formats>
      <format>zip</format>
    </formats>
    <fileSets>
      <fileSet>
         <directory>src/main</directory>
         <outputDirectory>/</outputDirectory>
         <excludes>
            <exclude>src/main/dml</exclude>
         </excludes>
      </fileSet>
    </fileSets>
    </assembly>

这是我的assemble.xml. src/main 包含多个文件夹.我想排除某些文件夹,例如 src/main/dml ,但不排除它.

This is my assemble.xml. src/main contains several folders. I want to exclude some folders, like src/main/dml, but it is not being excluded.

推荐答案

尝试以下排除方法:

  <excludes>
            <exclude>src/main/dml/**</exclude>
  </excludes>

匹配文件夹及其子文件夹的所有内容

to match all of the contents of the folder and its subfolders

更新:抱歉,您的排除对象是相对于您的目录的,所以您想要的是

UPDATE: oh I'm sorry, your excludes are relative to your directory, so what you want is

  <excludes>
            <exclude>dml/**</exclude>
  </excludes>

这篇关于通过Maven创建zip文件时如何排除某些文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆