In my maven project I have to a (fairly large amount) of RPMs. For convenience during deployment I want to assemble all the RPMs into a single archive (.tar.gz). The assembly runs in a separate module which depends on all the RPM modules.
For this I have the following assembly.xml
:
<?xml version="1.0"?>
<assembly>
<id>myproject-rpm-package</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>${project.parent.parent.name}-${project.version}-rpms</baseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>false</useProjectArtifact>
<includes>
<!-- Include only the RPMs -->
<include>*:rpm</include>
</includes>
<outputDirectory>/</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
This works well, but it renames all my RPMS to follow the format: <projectname>-<version>.rpm
. Losing useful properties in the RPM naming convention: <rpm name>-<version>-<release>.noarch.rpm
. The RPMS still work fine.
My suspicion is that this comes from the maven assembly property outputFileNameMapping.
Is my assumption correct? If so, how can I prevent the renaming of my RPM files by the assembly plugin?
Your assumption is correct. The
maven-assembly-plugin
will rename all the dependencies of your assembly project into the format specified byoutputFileNameMapping
:The documentation contains all values that you can specify in this attribute:
It looks like it is missing from the documentation, but starting from version 2.2, you can also use the
${artifact.properties.*}
property, as mentioned in the JIRA MASSEMBLY-498. This will reference custom properties you have set in this artifact inside the<properties>
element.So, for example, you could have:
Note that the plugin will always rename the files based on that pattern. There is no option to skip the renaming.