You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/03/14 20:28:34 UTC

svn commit: r518285 - /maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java

Author: carlos
Date: Wed Mar 14 12:28:34 2007
New Revision: 518285

URL: http://svn.apache.org/viewvc?view=rev&rev=518285
Log:
[MJAVADOC-115] getDocletPath does not return correct path
Submitted By: Mark Proctor

Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java

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?view=diff&rev=518285&r1=518284&r2=518285
==============================================================================
--- 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 Wed Mar 14 12:28:34 2007
@@ -1639,6 +1639,10 @@
     /**
      * Method to get the path of the doclet artifacts used in the -docletpath option.
      *
+     * Either docletArtifact or doclectArtifacts can be defined and used, not both, docletArtifact
+     * takes precedence over doclectArtifacts. docletPath is always appended to any result path
+     * definition.
+     *
      * @return the path to jar file that contains doclet class file separated with a colon (:)
      * on Solaris and a semi-colon (;) on Windows
      * @throws MavenReportException
@@ -1647,10 +1651,7 @@
         throws MavenReportException
     {
         StringBuffer path = new StringBuffer();
-
-        if ( ( docletArtifact != null ) && ( StringUtils.isNotEmpty( docletArtifact.getGroupId() ) )
-            && ( StringUtils.isNotEmpty( docletArtifact.getArtifactId() ) )
-            && ( StringUtils.isNotEmpty( docletArtifact.getVersion() ) ) )
+        if ( !isDocletArtifactEmpty( docletArtifact ) )
         {
             path.append( getArtifactAbsolutePath( docletArtifact ) );
         }
@@ -1658,7 +1659,7 @@
         {
             for ( int i = 0; i < docletArtifacts.length; i++ )
             {
-                if ( docletArtifacts[i] != null )
+                if ( !isDocletArtifactEmpty( docletArtifacts[i] ) )
                 {
                     path.append( getArtifactAbsolutePath( docletArtifacts[i] ) );
 
@@ -1669,7 +1670,8 @@
                 }
             }
         }
-        else
+
+        if ( !StringUtils.isEmpty( docletPath ) )
         {
             path.append( docletPath );
         }
@@ -1682,6 +1684,17 @@
         }
 
         return path.toString();
+    }
+
+    private boolean isDocletArtifactEmpty( DocletArtifact docletArtifact )
+    {
+        if ( docletArtifact == null )
+        {
+            return true;
+        }
+        return ( StringUtils.isEmpty( docletArtifact.getGroupId() )
+            && StringUtils.isEmpty( docletArtifact.getArtifactId() ) && StringUtils.isEmpty( docletArtifact
+            .getVersion() ) );
     }
 
     /**