You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/04/30 10:47:10 UTC

[maven-javadoc-plugin] 03/07: Add artifactFile to JavadocModule

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJAVADOC-634
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit ffda878385e1ceb12821015b6281b86566c809fb
Author: rfscholte <rf...@apache.org>
AuthorDate: Wed Apr 28 22:27:14 2021 +0200

    Add artifactFile to JavadocModule
---
 .../apache/maven/plugins/javadoc/AbstractJavadocMojo.java | 15 ++++-----------
 .../org/apache/maven/plugins/javadoc/JavadocModule.java   | 11 ++++++++++-
 .../maven/plugins/javadoc/resolver/ResourceResolver.java  |  8 ++++++--
 3 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 730b6c4..09c6dc8 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -2331,6 +2331,7 @@ public abstract class AbstractJavadocMojo
                 {
                     mappedSourcePaths.add( new JavadocModule( ArtifactUtils.versionlessKey( project.getGroupId(),
                                                                                             project.getArtifactId() ),
+                                                              getArtifactFile( project ),
                                                               sourcePaths ) );
                 }
             }
@@ -2375,6 +2376,7 @@ public abstract class AbstractJavadocMojo
                             mappedSourcePaths.add( new JavadocModule( 
                                                           ArtifactUtils.versionlessKey( subProject.getGroupId(),
                                                                                         subProject.getArtifactId() ),
+                                                          getArtifactFile( subProject ),
                                                           additionalSourcePaths ) );
                         }
                     }
@@ -2402,6 +2404,7 @@ public abstract class AbstractJavadocMojo
             {
                 mappedSourcePaths.add( new JavadocModule( ArtifactUtils.versionlessKey( project.getGroupId(),
                                                                                         project.getArtifactId() ),
+                                                          getArtifactFile( project ),
                                                           sourcePaths ) );
             }
         }
@@ -5015,17 +5018,7 @@ public abstract class AbstractJavadocMojo
         {
             for ( JavadocModule entry : allSourcePaths )
             {
-                MavenProject entryProject = reactorKeys.get( entry.getGa() );
-
-                File artifactFile;
-                if ( entryProject != null )
-                {
-                    artifactFile = getArtifactFile( entryProject );
-                }
-                else
-                {
-                    artifactFile = project.getArtifactMap().get( entry.getGa() ).getFile();
-                }
+                File artifactFile = entry.getArtifactFile();
                 
                 ResolvePathResult resolvePathResult = getResolvePathResult( artifactFile );
 
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocModule.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocModule.java
index 72b2308..31c6cc6 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocModule.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocModule.java
@@ -19,6 +19,7 @@ package org.apache.maven.plugins.javadoc;
  * under the License.
  */
 
+import java.io.File;
 import java.nio.file.Path;
 import java.util.Collection;
 
@@ -31,11 +32,14 @@ public class JavadocModule
 {
     private final String ga;
     
+    private final File artifactFile;
+    
     private final Collection<Path> sourcePaths;
 
-    public JavadocModule( String ga, Collection<Path> sourcePaths )
+    public JavadocModule( String ga, File artifactFile, Collection<Path> sourcePaths )
     {
         this.ga = ga;
+        this.artifactFile = artifactFile;
         this.sourcePaths = sourcePaths;
     }
 
@@ -48,4 +52,9 @@ public class JavadocModule
     {
         return sourcePaths;
     }
+    
+    public File getArtifactFile()
+    {
+        return artifactFile;
+    }
 }
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
index 7a3865c..01c7abc 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
@@ -166,7 +166,9 @@ public final class ResourceResolver extends AbstractLogEnabled
             final MavenProject p = projectMap.get( key );
             if ( p != null )
             {
-                mappedDirs.add( new JavadocModule( key, resolveFromProject( config, p, artifact ) ) );
+                mappedDirs.add( new JavadocModule( key, 
+                                                   artifact.getFile(),
+                                                   resolveFromProject( config, p, artifact ) ) );
             }
             else
             {
@@ -321,7 +323,9 @@ public final class ResourceResolver extends AbstractLogEnabled
         
         Collection<Path> sourcePaths = resolveAndUnpack( toResolve, config, SOURCE_VALID_CLASSIFIERS, true ); 
 
-        return new JavadocModule( key( artifact.getGroupId(), artifact.getArtifactId() ), sourcePaths );
+        return new JavadocModule( key( artifact.getGroupId(), artifact.getArtifactId() ),
+                                  artifact.getFile(),
+                                  sourcePaths );
     }
 
     private Artifact createResourceArtifact( final Artifact artifact, final String classifier,