I have a Maven RPM plugin mapping thus:
<mapping>
<directory>/etc/myconfig</directory>
<configuration>true</configuration>
<sources>
<source>
<location>${project.build.directory}</location>
<includes>
<include>*.conf</include>
</includes>
</source>
</sources>
</mapping>
However, depending on the packaging process, there may be zero .conf files to put in /etc. When this occurs, RPM plugin says:
[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]
Is there any way to have a mapping section that is happy with including zero files?
The best I've been able to come up with is omitting the <includes>
tag, which takes everything from what's specified in <location>
.
location
The file or directory to include. If a directory is specified, all files and subdirectories are also included.
You will need to be as specific as possible in the path for these mappings that don't have include patterns specified. I added confs
to the location below to avoid pulling in everything else in project.build.directory
.
Even if no files are selected, the <directory>
will still be created.
<mapping>
<directory>/etc/myconfig</directory>
<configuration>true</configuration>
<sources>
<source>
<location>${project.build.directory}/confs</location>
</source>
</sources>
</mapping>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With