You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/05/02 00:19:17 UTC

svn commit: r1098423 - in /maven/plugins/trunk/maven-javadoc-plugin: ./ src/it/site-failOnError/ src/it/site-failOnError/src/ src/it/site-failOnError/src/main/ src/it/site-failOnError/src/main/java/ src/main/java/org/apache/maven/plugin/javadoc/

Author: hboutemy
Date: Sun May  1 22:19:17 2011
New Revision: 1098423

URL: http://svn.apache.org/viewvc?rev=1098423&view=rev
Log:
[MJAVADOC-304] added failOnError support when plugin run as a report

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java   (with props)
Modified:
    maven/plugins/trunk/maven-javadoc-plugin/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java

Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=1098423&r1=1098422&r2=1098423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Sun May  1 22:19:17 2011
@@ -371,21 +371,22 @@ under the License.
               <projectsDirectory>src/it</projectsDirectory>
               <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
               <pomIncludes>
-                <pomInclude>**/MJAVADOC-110/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-126/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-137/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-172/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-180/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-194/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-206/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-226/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-97/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-110/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-126/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-137/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-172/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-180/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-194/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-206/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-226/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-97/pom.xml</pomInclude>
                 <!-- pomInclude>**/MJAVADOC-181/pom.xml</pomInclude--><!-- seems to be wrong, see comment in Jira issue  -->
-                <pomInclude>**/MJAVADOC-257/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-259/pom.xml</pomInclude>
-                <pomInclude>**/MJAVADOC-262/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-257/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-259/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-262/pom.xml</pomInclude>
                 <pomInclude>MJAVADOC-275/pom.xml</pomInclude>
                 <pomInclude>MJAVADOC-280-*/pom.xml</pomInclude>
+                <pomInclude>site-failOnError/pom.xml</pomInclude>
               </pomIncludes>
               <postBuildHookScript>verify</postBuildHookScript>
               <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt?rev=1098423&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt Sun May  1 22:19:17 2011
@@ -0,0 +1 @@
+clean site
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/goals.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml?rev=1098423&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml Sun May  1 22:19:17 2011
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+  <artifactId>MJAVADOC-304</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>MJAVADOC-304: failOnError=false in site</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>@sitePluginVersion@</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>@pom.version@</version>
+          <configuration>
+            <failOnError>false</failOnError>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <failOnError>false</failOnError>
+        </configuration>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>javadoc</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java?rev=1098423&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java Sun May  1 22:19:17 2011
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Hello world!
+ */
+class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/site-failOnError/src/main/java/App.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=1098423&r1=1098422&r2=1098423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Sun May  1 22:19:17 2011
@@ -454,7 +454,7 @@ public abstract class AbstractJavadocMoj
     protected boolean skip;
 
     /**
-     * Specifies whether the build will continue even if there are errors.
+     * Specifies if the build will fail if there are errors during javadoc execution or not.
      *
      * @parameter expression="${maven.javadoc.failOnError}" default-value="true"
      * @since 2.5
@@ -5774,9 +5774,9 @@ public abstract class AbstractJavadocMoj
             {
                 throw (RuntimeException) e;
             }
-            throw new MojoExecutionException( prefix + e.getMessage(), e );
+            throw new MojoExecutionException( prefix + ": " + e.getMessage(), e );
         }
 
-        getLog().error( prefix + e.getMessage(), e );
+        getLog().error( prefix + ": " + e.getMessage(), e );
     }
 }

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java?rev=1098423&r1=1098422&r2=1098423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocJar.java Sun May  1 22:19:17 2011
@@ -196,19 +196,19 @@ public class JavadocJar
         }
         catch ( ArchiverException e )
         {
-            failOnError( "ArchiverException: Error while creating archive: ", e );
+            failOnError( "ArchiverException: Error while creating archive", e );
         }
         catch ( IOException e )
         {
-            failOnError( "IOException: Error while creating archive: ", e );
+            failOnError( "IOException: Error while creating archive", e );
         }
         catch ( MavenReportException e )
         {
-            failOnError( "MavenReportException: Error while creating archive: ", e );
+            failOnError( "MavenReportException: Error while creating archive", e );
         }
         catch ( RuntimeException e )
         {
-            failOnError( "RuntimeException: Error while creating archive: ", e );
+            failOnError( "RuntimeException: Error while creating archive", e );
         }
     }
 

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java?rev=1098423&r1=1098422&r2=1098423&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocReport.java Sun May  1 22:19:17 2011
@@ -121,7 +121,26 @@ public class JavadocReport
     {
         outputDirectory = getReportOutputDirectory();
 
-        executeReport( locale );
+        try
+        {
+            executeReport( locale );
+        }
+        catch ( MavenReportException e )
+        {
+            if ( failOnError )
+            {
+                throw e;
+            }
+            getLog().error( "Error while creating javadoc report: " + e.getMessage(), e );
+        }
+        catch ( RuntimeException e )
+        {
+            if ( failOnError )
+            {
+                throw e;
+            }
+            getLog().error( "Error while creating javadoc report: " + e.getMessage(), e );
+        }
     }
 
     /** {@inheritDoc} */
@@ -293,11 +312,11 @@ public class JavadocReport
         }
         catch ( MavenReportException e )
         {
-            failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation:", e );
+            failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );
         }
         catch ( RuntimeException e )
         {
-            failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation:", e );
+            failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );
         }
     }