如何在Maven程序集中包含一个空目录? [英] How do I include an empty directory in a maven assembly?

查看:192
本文介绍了如何在Maven程序集中包含一个空目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一种常见的情况下,我需要在程序集中包含一个空目录.就我而言,它是logs/.

In what must be a common occurence, I need to include an empty directory in an assembly. In my case it is logs/.

我在汇编描述符中尝试了不同的变体,例如:

I've tried different variations in the assembly descriptor like:

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

并且该目录刚刚被修剪.

and the directory just gets pruned.

我也试图排除在外,但这仍然包括很多东西:

I tried to exclude as well, but that still included lots of stuff:

<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程序集中包含一个空目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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