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 2008/07/24 23:34:33 UTC

svn commit: r679551 - in /maven/components/branches/maven-2.0.10-RC: maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java pom.xml

Author: jdcasey
Date: Thu Jul 24 14:34:33 2008
New Revision: 679551

URL: http://svn.apache.org/viewvc?rev=679551&view=rev
Log:
[MNG-3680] Upgrade to alpha-20-snapshot of modello for fixes to the xpp3 plugin there, and improve handling of invalid POMs in the metadata source to avoid repeating warnings.

Modified:
    maven/components/branches/maven-2.0.10-RC/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
    maven/components/branches/maven-2.0.10-RC/pom.xml

Modified: maven/components/branches/maven-2.0.10-RC/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=679551&r1=679550&r2=679551&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.10-RC/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java (original)
+++ maven/components/branches/maven-2.0.10-RC/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java Thu Jul 24 14:34:33 2008
@@ -19,6 +19,16 @@
  * under the License.
  */
 
+import java.io.File;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
@@ -49,14 +59,6 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
@@ -76,6 +78,8 @@
 
     // lazily instantiated and cached.
     private MavenProject superProject;
+    
+    private Set warnedPoms = new HashSet();
 
     /**
      * Resolve all relocations in the POM for this artifact, and return the new artifact coordinate.
@@ -162,23 +166,31 @@
                 }
                 catch ( InvalidProjectModelException e )
                 {
-                    getLogger().warn( "POM for \'" + pomArtifact +
-                        "\' is invalid. It will be ignored for artifact resolution. Reason: " + e.getMessage() );
-
-                    if ( getLogger().isDebugEnabled() )
+                    String id = pomArtifact.getId();
+                    
+                    if ( !warnedPoms.contains( id ) )
                     {
-                        getLogger().debug( "Reason: " + e.getMessage() );
+                        warnedPoms.add( pomArtifact.getId() );
 
-                        ModelValidationResult validationResult = e.getValidationResult();
+                        getLogger().warn( "POM for \'"
+                                              + pomArtifact
+                                              + "\' is invalid.\n\nIts dependencies (if any) will NOT be available to the current build." );
 
-                        if ( validationResult != null )
+                        if ( getLogger().isDebugEnabled() )
                         {
-                            getLogger().debug( "\nValidation Errors:" );
-                            for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
+                            getLogger().debug( "Reason: " + e.getMessage() );
+
+                            ModelValidationResult validationResult = e.getValidationResult();
+
+                            if ( validationResult != null )
                             {
-                                getLogger().debug( i.next().toString() );
+                                getLogger().debug( "\nValidation Errors:" );
+                                for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext(); )
+                                {
+                                    getLogger().debug( i.next().toString() );
+                                }
+                                getLogger().debug( "\n" );
                             }
-                            getLogger().debug( "\n" );
                         }
                     }
 
@@ -515,5 +527,5 @@
         private MavenProject project;
         private Artifact pomArtifact;
     }
-
+    
 }

Modified: maven/components/branches/maven-2.0.10-RC/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.10-RC/pom.xml?rev=679551&r1=679550&r2=679551&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.10-RC/pom.xml (original)
+++ maven/components/branches/maven-2.0.10-RC/pom.xml Thu Jul 24 14:34:33 2008
@@ -175,7 +175,7 @@
         <plugin>
           <groupId>org.codehaus.modello</groupId>
           <artifactId>modello-maven-plugin</artifactId>
-          <version>1.0-alpha-19</version>
+          <version>1.0-alpha-20-SNAPSHOT</version>
           <executions>
             <execution>
               <id>site-docs</id>