You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2007/08/16 18:39:43 UTC

svn commit: r566771 - /maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java

Author: jdcasey
Date: Thu Aug 16 09:39:43 2007
New Revision: 566771

URL: http://svn.apache.org/viewvc?view=rev&rev=566771
Log:
Adding better warnings about replacing the main project artifact's file when appendAssemblyId==false and classifier==null.

Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java?view=diff&rev=566771&r1=566770&r2=566771
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java Thu Aug 16 09:39:43 2007
@@ -263,6 +263,7 @@
         // TODO: include dependencies marked for distribution under certain formats
         // TODO: how, might we plug this into an installer, such as NSIS?
 
+        boolean warnedAboutMainProjectArtifact = false;
         for ( Iterator assemblyIterator = assemblies.iterator(); assemblyIterator.hasNext(); )
         {
             Assembly assembly = (Assembly) assemblyIterator.next();
@@ -291,13 +292,24 @@
                         }
                         else
                         {
-                            StringBuffer message = new StringBuffer();
+                            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!" );
+
+                                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 );
+                            }
 
-                            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 );
                             project.getArtifact().setFile( destFile );
                         }
                     }