maven - 如何在通过 maven 创建 zip 文件时排除某些文件夹

标签 maven maven-assembly-plugin

<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/dml ,但它并没有被排除在外。

最佳答案

试试这个排除:

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

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

更新:哦,对不起,你的排除是相对于你的目录,所以你想要的是
  <excludes>
            <exclude>dml/**</exclude>
  </excludes>

关于maven - 如何在通过 maven 创建 zip 文件时排除某些文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16214086/

相关文章:

java - Maven SNAPSHOT 被视为 RELEASE

java - 尽管定义了依赖项,但获取 java.lang.ClassNotFoundException : com. sun.xml.internal.ws.spi.ProviderImpl

java - eclipse 火星 : Maven M2_REPO not modifiable

java - 为什么 Maven Assembly Plugin 不将我的项目文件包含在具有依赖项的 jar 中?

java - 带有外部 jar 的 Maven 程序集

java - 类级别未使用的传递依赖分析

java - Jenkins 将浏览器 URL 作为 Maven Selenium Java 测试的参数传递

maven-2 - 使用 Maven 创建一个 zip 文件,其中包含具有依赖关系的可执行 jar

Maven 程序集 : including a file at the same level of baseDirectory

java - Maven:使用 jar-with-dependencies 分发源代码