continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r379171 - /maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
Date Mon, 20 Feb 2006 17:23:19 GMT
Author: evenisse
Date: Mon Feb 20 09:23:11 2006
New Revision: 379171

URL: http://svn.apache.org/viewcvs?rev=379171&view=rev
Log:
Print validation messages when pom parsing fail

Modified:
    maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java

Modified: maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java?rev=379171&r1=379170&r2=379171&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
(original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/execution/maven/m2/DefaultMavenBuilderHelper.java
Mon Feb 20 09:23:11 2006
@@ -33,8 +33,10 @@
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.profiles.DefaultProfileManager;
 import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.InvalidProjectModelException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.validation.ModelValidationResult;
 import org.apache.maven.settings.MavenSettingsBuilder;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.Proxy;
@@ -306,7 +308,25 @@
         }
         catch ( Exception e )
         {
-            String msg = "Cannot build maven project from " + file + " (" + e.getMessage()
+ ").";
+            StringBuffer messages = new StringBuffer();
+
+            if ( e instanceof InvalidProjectModelException )
+            {
+                InvalidProjectModelException ex = (InvalidProjectModelException) e;
+
+                ModelValidationResult validationResult = ex.getValidationResult();
+
+                if ( validationResult != null && validationResult.getMessageCount()
> 0 )
+                {
+                    for ( Iterator i = validationResult.getMessages().iterator(); i.hasNext();
)
+                    {
+                        messages.append( (String) i.next() );
+                        messages.append( "\n" );
+                    }
+                }
+            }
+
+            String msg = "Cannot build maven project from " + file + " (" + e.getMessage()
+ ").\n" + messages;
 
             getLogger().error( msg, e );
 



Mime
View raw message