Search code examples
mavenmaven-assembly-plugin

Why maven assembly create manifest if file format is rar?


I have a Maven project with the following assembly descriptor:

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assemby-id</id>
<formats>
    <format>rar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
    <file>
        <source>${project.build.directory}/resources/file.txt</source>
        <outputDirectory>/</outputDirectory>
    </file>
</files>

If the format is rar, I get a folder META-INF with a manifest file in the rar.

Can someone explain why?


Solution

  • The maven-assembly-plugin does not support the rar archive format. Quoting the format documentation, the list of supported formats is:

    • "zip" - Creates a ZIP file format
    • "tar" - Creates a TAR format
    • "tar.gz" or "tgz" - Creates a gzip'd TAR format
    • "tar.bz2" or "tbz2" - Creates a bzip'd TAR format
    • "jar" - Creates a JAR format
    • "dir" - Creates an exploded directory format
    • "war" - Creates a WAR format

    When the archiver encounters an unknown format, it defaults to jar and for this format, a META-INF directory is created by default.

    As such, the assembly you have created is not a valid RAR file. It is in fact a JAR file.