Oleksii Batiuk created MASSEMBLY-657:
----------------------------------------

             Summary: "jar" assembly format produces unexpected MANIFEST files 
and ignores "index" attribute with different archive settings
                 Key: MASSEMBLY-657
                 URL: https://jira.codehaus.org/browse/MASSEMBLY-657
             Project: Maven 2.x Assembly Plugin
          Issue Type: Bug
          Components: manifest
    Affects Versions: 2.4
            Reporter: Oleksii Batiuk
         Attachments: manifest-test-0.1-project.zip

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:_

{code:xml}      
<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>
{code}

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

{quote}
Manifest-Version: 1.0
DisplayName: Test Display Name
{quote}

*Test #1*

Execution that generates jar using default archiver MANIFEST file:

{code:xml}
<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>
{code}

_Expected result:_

INDEX.LIST file is present and contains:

{quote}JarIndex-Version: 1.0

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

MANIFEST.MF file is present and contains:

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

_Actual Result:_

{color:red}INDEX.LIST file is missing.{color}

{color:green}MANIFEST.MF file exists and contains expected entries.{color}

*Test #2*

Execution that generates jar using custom MANIFEST file:

{code:xml}
<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>
{code}

_Expected Result:_

INDEX.LIST file is present and contains:

{quote}JarIndex-Version: 1.0

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

MANIFEST.MF file is present and contains:

{quote}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
{quote}

_Actual Result:_

{color:red}INDEX.LIST file is missing.{color}

{color:red}MANIFEST.MF file exists, but contains unexpected entries:{color}
{quote}
Manifest-Version: 1.0
Created-By: 20.45-b01 (Sun Microsystems Inc.)
DisplayName: Test Display Name
Archiver-Version: Plexus Archiver
{quote}

*Test #3*

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

{code:xml}
<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>
{code}

_Expected Result:_

INDEX.LIST file is present and contains:

{quote}JarIndex-Version: 1.0

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

MANIFEST.MF file is present and contains:

{quote}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
{quote}

_Actual Result:_

{color:red}INDEX.LIST file is missing.{color}

{color:red}MANIFEST.MF file exists, but contains unexpected entries:{color}
{quote}
Manifest-Version: 1.0
Created-By: 20.45-b01 (Sun Microsystems Inc.)
DisplayName: Test Display Name
Archiver-Version: Plexus Archiver
{quote}

*Additional information:*

Maven version: 3.0.5
Java version: 1.6.0_45

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to