1

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?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Anton
  • 1,051
  • 1
  • 9
  • 21
  • Probably the specification for J2EE Resource Adapter Archives mandates that? – Michael-O Oct 21 '15 at 09:33
  • If you need a `rar` format i would recommend to take a look at the [maven-rar-plugin](https://maven.apache.org/plugins/maven-rar-plugin/)? – khmarbaise Oct 21 '15 at 11:43

2 Answers2

2

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
-1

The maven-assembly-plugin uses the maven-archiver for packaging. The maven-archiver adds a MANIFEST.MF to your package.

Update:

As mentioned here, you may configure the maven-archiver-plugin to leave out the DefaultImplementationEntries:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
      <archive>
        <manifest>
          <addDefaultImplementationEntries>false</addDefaultImplementationEntries>
        </manifest>
      </archive>
    </configuration>
</plugin> 
Community
  • 1
  • 1
michaelbahr
  • 4,837
  • 2
  • 39
  • 75