Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-657

"jar" assembly format produces unexpected MANIFEST files and ignores "index" attribute with different archive settings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Auto Closed
    • 2.4
    • None
    • manifest
    • None

    Description

      Basically, the problem is that assembly plugin generates unexpected MANIFEST.MF file and ignores "index" attributes when using "jar" format.

      Assumption

      Expected result is based on assumption that plugin should produce the same result as default jar plugin does when using the same archive settings (they both backed by the maven archiver). Attached archive contains test project that generates three jars using the "maven-jar-plugin" and three other jars using the "maven-assembly-plugin". Both plugins has the same archive settings.

      Test Data

      Basic assembly plugin configuration:

      	
      <plugin>
      	<groupId>org.apache.maven.plugins</groupId>
      	<artifactId>maven-assembly-plugin</artifactId>
      	<version>2.4</version>
      
      	<!-- Shared basic configuration -->
      	<configuration>
      		<appendAssemblyId>false</appendAssemblyId>
      		<attach>false</attach>
      		<descriptorId>jar-with-dependencies</descriptorId>
      		<format>jar</format>
      		<archive>
      			<!-- Do not put POM descriptor -->
      			<addMavenDescriptor>false</addMavenDescriptor>
      			<!-- Generate INDEX.LIST file -->
      			<index>true</index>
      		</archive>
      	</configuration>
      	...
      </plugin>
      

      src/main/assembly/META-INF/MANIFEST.MF:

      Manifest-Version: 1.0
      DisplayName: Test Display Name

      Test #1

      Execution that generates jar using default archiver MANIFEST file:

      <execution>
      	<id>assembly-with-default-manifest</id>
      	<phase>package</phase>
      	<goals>
      		<goal>single</goal>
      	</goals>
      	<configuration>
      		<finalName>${project.build.finalName}-assembly-default-manifest</finalName>
      	</configuration>
      </execution>
      

      Expected result:

      INDEX.LIST file is present and contains:

      JarIndex-Version: 1.0

      manifest-test-0.1-assembly-default-manifest.jar
      ru
      ru/javatalks
      ru/javatalks/tests

      MANIFEST.MF file is present and contains:

      Manifest-Version: 1.0
      Built-By: gesser
      Build-Jdk: 1.6.0_45
      Created-By: Apache Maven 3.0.5
      Archiver-Version: Plexus Archiver

      Actual Result:

      INDEX.LIST file is missing.

      MANIFEST.MF file exists and contains expected entries.

      Test #2

      Execution that generates jar using custom MANIFEST file:

      <execution>
      	<id>assembly-with-custom-manifest</id>
      	<phase>package</phase>
      	<goals>
      		<goal>single</goal>
      	</goals>
      	<configuration>
      		<finalName>${project.build.finalName}-assembly-custom-manifest</finalName>
      		<archive>
      			<manifestFile>src/main/assembly/META-INF/MANIFEST.MF</manifestFile>
      		</archive>
      	</configuration>
      </execution>
      

      Expected Result:

      INDEX.LIST file is present and contains:

      JarIndex-Version: 1.0

      manifest-test-0.1-assembly-custom-manifest.jar
      ru
      ru/javatalks
      ru/javatalks/tests

      MANIFEST.MF file is present and contains:

      Manifest-Version: 1.0
      Built-By: gesser
      Build-Jdk: 1.6.0_45
      Created-By: Apache Maven 3.0.5
      DisplayName: Test Display Name
      Archiver-Version: Plexus Archiver

      Actual Result:

      INDEX.LIST file is missing.

      MANIFEST.MF file exists, but contains unexpected entries:

      Manifest-Version: 1.0
      Created-By: 20.45-b01 (Sun Microsystems Inc.)
      DisplayName: Test Display Name
      Archiver-Version: Plexus Archiver

      Test #3

      Execution that generates jar using custom MANIFEST file plus custom entries:

      <execution>
      	<id>assembly-with-custom-manifest-and-entries</id>
      	<phase>package</phase>
      	<goals>
      		<goal>single</goal>
      	</goals>
      	<configuration>
      		<finalName>${project.build.finalName}-assembly-custom-manifest-and-entries</finalName>
      		<archive>
      			<manifestFile>src/main/assembly/META-INF/MANIFEST.MF</manifestFile>
      			<manifestEntries>
      				<Built-date>${maven.build.timestamp}</Built-date>
      				<Version>${project.version}</Version>
      			</manifestEntries>
      		</archive>
      	</configuration>
      </execution>
      

      Expected Result:

      INDEX.LIST file is present and contains:

      JarIndex-Version: 1.0

      manifest-test-0.1-assembly-custom-manifest-and-entries.jar
      ru
      ru/javatalks
      ru/javatalks/tests

      MANIFEST.MF file is present and contains:

      Manifest-Version: 1.0
      Built-By: gesser
      Build-Jdk: 1.6.0_45
      Created-By: Apache Maven 3.0.5
      Built-date: 20130623-2318
      DisplayName: Test Display Name
      Version: 0.1
      Archiver-Version: Plexus Archiver

      Actual Result:

      INDEX.LIST file is missing.

      MANIFEST.MF file exists, but contains unexpected entries:

      Manifest-Version: 1.0
      Created-By: 20.45-b01 (Sun Microsystems Inc.)
      DisplayName: Test Display Name
      Archiver-Version: Plexus Archiver

      Additional information:

      Maven version: 3.0.5
      Java version: 1.6.0_45

      Attachments

        1. manifest-test-0.1-project.zip
          5 kB
          Oleksii Batiuk

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gesser Oleksii Batiuk
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: