[ 
http://jira.codehaus.org/browse/MASSEMBLY-517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=240982#action_240982
 ] 

John Casey edited comment on MASSEMBLY-517 at 10/25/10 4:49 PM:
----------------------------------------------------------------

The assembly id is used to report problems to the user, and for duplication 
detection. Not to mention that, if left off, it could override the main project 
jar (in cases, unlike yours, where people have distinct main project jars) 
without much warning.

The following snippet from AbstractAssemblyMojo should ensure that the 
<appendAssemblyId/> flag works properly:

{code}
if ( isAssemblyIdAppended() )
{
    projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
}
else if ( classifier != null )
{
    projectHelper.attachArtifact( project, format, classifier, destFile );
}
else if ( !"pom".equals( type ) && format.equals( type ) )
{
    if ( !warnedAboutMainProjectArtifact )
    {
        final StringBuffer message = new StringBuffer();

        message.append( "Configuration options: 'appendAssemblyId' is set to 
false, and 'classifier' is missing." );
        message.append( "\nInstead of attaching the assembly file: " )
               .append( destFile )
               .append( ", it will become the file for main project artifact." 
);
        message.append( "\nNOTE: If multiple descriptors or descriptor-formats 
are provided for this project, the value of this file will be 
non-deterministic!" );

        getLog().warn( message );
        warnedAboutMainProjectArtifact = true;
    }

    final File existingFile = project.getArtifact()
                                     .getFile();
    if ( ( existingFile != null ) && existingFile.exists() )
    {
        getLog().warn( "Replacing pre-existing project main-artifact file: " + 
existingFile
                                       + "\nwith assembly file: " + destFile );
    }

    project.getArtifact()
           .setFile( destFile );
}
else
{
    projectHelper.attachArtifact( project, format, null, destFile );
}

{code}

If this isn't working, then that's the bug here. IMO it's not appropriate to 
make the <id/> optional and create a hardship for new users (who may not 
understand the implications), just to allow other users to avoid using the 
proper plugin configuration.

      was (Author: jdcasey):
    The assembly id is used to report problems to the user, and for duplication 
detection. Not to mention that, if left off, it could override the main project 
jar (in cases, unlike yours, where people have distinct main project jars) 
without much warning.

The following snippet from AbstractAssemblyMojo should ensure that the 
<appendAssemblyId/> flag works properly:

{code}
                        if ( isAssemblyIdAppended() )
                        {
                            projectHelper.attachArtifact( project, format, 
assembly.getId(), destFile );
                        }
                        else if ( classifier != null )
                        {
                            projectHelper.attachArtifact( project, format, 
classifier, destFile );
                        }
                        else if ( !"pom".equals( type ) && format.equals( type 
) )
                        {
                            if ( !warnedAboutMainProjectArtifact )
                            {
                                final StringBuffer message = new StringBuffer();

                                message.append( "Configuration options: 
'appendAssemblyId' is set to false, and 'classifier' is missing." );
                                message.append( "\nInstead of attaching the 
assembly file: " )
                                       .append( destFile )
                                       .append( ", it will become the file for 
main project artifact." );
                                message.append( "\nNOTE: If multiple 
descriptors or descriptor-formats are provided for this project, the value of 
this file will be non-deterministic!" );

                                getLog().warn( message );
                                warnedAboutMainProjectArtifact = true;
                            }

                            final File existingFile = project.getArtifact()
                                                             .getFile();
                            if ( ( existingFile != null ) && 
existingFile.exists() )
                            {
                                getLog().warn( "Replacing pre-existing project 
main-artifact file: " + existingFile
                                                               + "\nwith 
assembly file: " + destFile );
                            }

                            project.getArtifact()
                                   .setFile( destFile );
                        }
                        else
                        {
                            projectHelper.attachArtifact( project, format, 
null, destFile );
                        }

{code}

If this isn't working, then that's the bug here. IMO it's not appropriate to 
make the <id/> optional and create a hardship for new users (who may not 
understand the implications), just to allow other users to avoid using the 
proper plugin configuration.
  
> Assembly fails with empty id element now
> ----------------------------------------
>
>                 Key: MASSEMBLY-517
>                 URL: http://jira.codehaus.org/browse/MASSEMBLY-517
>             Project: Maven 2.x Assembly Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Eric Haszlakiewicz
>            Priority: Critical
>
> There is a serious regression in behaviour between version 2.2-beta-5 and 
> 2.2.  With version 2.2, assembly descriptors that have an empty id element no 
> longer work.  i.e.:
> <assembly>
>     <id></id>
>     <formats><format>tar.gz</format></formats>
> </assembly>
>    
> The error message is:
> [INFO] [assembly:single {execution: assemble-tar-gzip}]
> [INFO] Reading assembly descriptor: src/main/assembly/assembly.xml
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] : org.apache.maven.plugin.assembly.model.assem...@15fddb33
> Assembly is incorrectly configured:
> Assembly:  is not configured correctly: Assembly ID must be present and 
> non-empty.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to