gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:06:10 34 4
gpt4 key购买 nike

我有一个 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>

但是,根据打包过程的不同,/etc 中可能有零个 .conf 文件。发生这种情况时,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]

有什么方法可以让映射部分满意地包含零个文件吗?

最佳答案

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

location

The file or directory to include. If a directory is specified, all files and subdirectories are also included.

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

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

<mapping>
<directory>/etc/myconfig</directory>
<configuration>true</configuration>
<sources>
<source>
<location>${project.build.directory}/confs</location>
</source>
</sources>
</mapping>

关于maven - Maven RPM 插件中的可选映射部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29276399/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com