maven - 如何在 Maven 程序集中包含一个空目录?

标签 maven maven-assembly-plugin

在必须是常见的情况下,我需要在程序集中包含一个空目录。就我而言,它是日志/。

我在程序集描述符中尝试了不同的变体,例如:

<fileSet>
  <directory>${basedir}/target</directory>
  <includes>
    <include>doesntexist</include>
  </includes>
  <outputDirectory>/logs</outputDirectory>
  <fileMode>0644</fileMode>
</fileSet>

并且目录刚刚被修剪。

我也试图排除,但这仍然包括很多东西:
<fileSet>
  <directory>${basedir}/target</directory>
  <excludes>
    <exclude>*</exclude>
  </excludes>
  <outputDirectory>/logs</outputDirectory>
  <fileMode>0644</fileMode>
</fileSet>

最佳答案

这总是对我有用:

<fileSets>
  <fileSet>
    <directory>.</directory>
    <outputDirectory>logs</outputDirectory>
    <excludes>
      <exclude>*/**</exclude>
    </excludes>
  </fileSet>
</fileSets>

关于maven - 如何在 Maven 程序集中包含一个空目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7909183/

相关文章:

java - Jar 文件有类,但我仍然得到 java.lang.ClassNotFoundException : org. apache.kafka.clients.consumer.ConsumerRecord

java - Maven随机不过滤资源

maven - 从 Maven 存储库获取 Artifact 的所有文件

java - 重新加载在 Eclipse 中编辑的 JSP,使用 tomcat7-maven-plugin 运行

java - 在单个 jar 中组装多模块 maven 项目

java - Maven组装插件添加依赖项

java - "Required filename-based automodules detected."警告是什么意思?

Maven:冲突的 jar 依赖项

maven - 如何在maven程序集中包含依赖文件

maven - 使用 Maven 构建 fat jar