Maven RPM插件中的可选映射部分?

Bit*_*nce 7 maven rpm-maven-plugin

我有一个Maven RPM插件映射:

<mapping>
  <directory>/etc/myconfig</directory>
  <configuration>true</configuration>
  <sources>
    <source>
      <location>${project.build.directory}</location>
      <includes>
        <include>*.conf</include>
      </includes>
    </source>
  </sources>
</mapping>
Run Code Online (Sandbox Code Playgroud)

但是,根据打包过程,可能会有零.conf文件放入/ etc.发生这种情况时,RPM插件会说:

[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.2:rpm (default) on project clients: 
Unable to copy files for packaging: You must set at least one file. -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

有没有办法让一个映射部分满意包含零文件?

hav*_*ked 2

我能想到的最好的办法就是省略标签<includes>,它会从中指定的内容中获取所有内容<location>。

地点

要包含的文件或目录。如果指定了目录,则还包括所有文件和子目录。

您需要在这些未指定包含模式的映射的路径中尽可能具体。我添加confs到下面的位置以避免拉入其他所有内容project.build.directory。

即使没有选择任何文件,<directory>仍然会创建文件。

<mapping>
  <directory>/etc/myconfig</directory>
  <configuration>true</configuration>
  <sources>
    <source>
      <location>${project.build.directory}/confs</location>   
    </source>
  </sources>
</mapping>
Run Code Online (Sandbox Code Playgroud)