Index: src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java =================================================================== --- src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (revision 633439) +++ src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (working copy) @@ -324,43 +324,46 @@ MavenProject project = getProject(); String classifier = getClassifier(); - if ( attach && destFile.isFile() ) + if ( attach ) { - if ( isAssemblyIdAppended() ) + if ( destFile.isFile() ) { - projectHelper.attachArtifact( project, format, assembly.getId(), destFile ); - } - else if ( classifier != null ) - { - projectHelper.attachArtifact( project, format, classifier, destFile ); - } - else - { - if ( !warnedAboutMainProjectArtifact ) + if ( isAssemblyIdAppended() ) { - StringBuffer message = new StringBuffer(); + projectHelper.attachArtifact( project, format, assembly.getId(), destFile ); + } + else if ( classifier != null ) + { + projectHelper.attachArtifact( project, format, classifier, destFile ); + } + else + { + if ( !warnedAboutMainProjectArtifact ) + { + 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!" ); + 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; - } + getLog().warn( message ); + warnedAboutMainProjectArtifact = true; + } - File existingFile = project.getArtifact().getFile(); - if ( ( existingFile != null ) && existingFile.exists() ) - { - getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile + "\nwith assembly file: " + destFile ); + 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 ); } - - project.getArtifact().setFile( destFile ); } + else + { + getLog().warn( "Assembly file: " + destFile + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment." ); + } } - else - { - getLog().warn( "Assembly file: " + destFile + " is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment." ); - } } } catch ( ArchiveCreationException e )