You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2010/09/13 23:02:03 UTC

svn commit: r996688 - /maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java

Author: olamy
Date: Mon Sep 13 21:02:03 2010
New Revision: 996688

URL: http://svn.apache.org/viewvc?rev=996688&view=rev
Log:
[MPDF-41] with maven 3 pdf failure if reporting section is not empty
ignore NoSuchMethodError to prevent failure for maven 3 users.

Modified:
    maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java

Modified: maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=996688&r1=996687&r2=996688&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java (original)
+++ maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java Mon Sep 13 21:02:03 2010
@@ -1051,27 +1051,30 @@ public class PdfMojo
 
             final PluginDescriptor pluginDescriptor = getPluginDescriptor( reportPlugin );
 
-            List goals = new ArrayList();
-            for ( final Iterator it2 = reportPlugin.getReportSets().iterator(); it2.hasNext(); )
+            if (pluginDescriptor != null)
             {
-                final ReportSet reportSet = (ReportSet) it2.next();
-
-                for ( final Iterator it3 = reportSet.getReports().iterator(); it3.hasNext(); )
+                List goals = new ArrayList();
+                for ( final Iterator it2 = reportPlugin.getReportSets().iterator(); it2.hasNext(); )
                 {
-                    goals.add( it3.next().toString() );
+                    final ReportSet reportSet = (ReportSet) it2.next();
+    
+                    for ( final Iterator it3 = reportSet.getReports().iterator(); it3.hasNext(); )
+                    {
+                        goals.add( it3.next().toString() );
+                    }
                 }
-            }
-
-            List mojoDescriptors = pluginDescriptor.getMojos();
-            for ( final Iterator it2 = mojoDescriptors.iterator(); it2.hasNext(); )
-            {
-                final MojoDescriptor mojoDescriptor = (MojoDescriptor) it2.next();
-
-                if ( goals.isEmpty() || ( !goals.isEmpty() && goals.contains( mojoDescriptor.getGoal() ) ) )
-                {
-                    MavenReport report = getMavenReport( mojoDescriptor );
-
-                    generateMavenReport( mojoDescriptor, report, locale );
+    
+                List mojoDescriptors = pluginDescriptor.getMojos();
+                for ( final Iterator it2 = mojoDescriptors.iterator(); it2.hasNext(); )
+                {
+                    final MojoDescriptor mojoDescriptor = (MojoDescriptor) it2.next();
+    
+                    if ( goals.isEmpty() || ( !goals.isEmpty() && goals.contains( mojoDescriptor.getGoal() ) ) )
+                    {
+                        MavenReport report = getMavenReport( mojoDescriptor );
+    
+                        generateMavenReport( mojoDescriptor, report, locale );
+                    }
                 }
             }
         }
@@ -1103,6 +1106,7 @@ public class PdfMojo
     }
 
     /**
+     * TODO olamy : remove when maven 3 will be the de facto standard :-)
      * @param reportPlugin not null
      * @return the PluginDescriptor instance for the given reportPlugin.
      * @throws MojoExecutionException if any
@@ -1147,6 +1151,11 @@ public class PdfMojo
         {
             throw new MojoExecutionException( "PluginVersionNotFoundException: " + e.getMessage(), e );
         }
+        catch ( NoSuchMethodError e )
+        {
+            getLog().info( "ignoring not anymore existing api call in maven 3" );
+            return null;
+        }
     }
 
     /**