Maven Javadoc Plugin
  1. Maven Javadoc Plugin
  2. MJAVADOC-320

includeDependencySources does not handle external dependencies and filters for reactor dependencies correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.8.1
    • Labels:
      None

      Description

      Setting includeDependencySources=true should include the -sources artifacts of the dependencies of the current project, filtered via dependencySourceIncludes and/or dependencySourceExcludes, in the javadoc generation. However, there are some major issues with the current implementation:

      1) filters are ignored for reactor dependencies: Scenario: you have an aggregator project consisting of 3 modules, the 3rd module has a dependency to the first and second one, it has includeDependencySources set to true and explicitly excluded the 2nd module from the javadoc sources via dependencySourceExcludes. If you build the aggregator project, the 2nd module will be included nevertheless (filter does not work), but if you build module 3 only, it works as expected.

      2) external dependencies are not added to the javadoc generation: if you have a project which has a dependency which is not part of the current project (e.g. the servlet-api in MyFaces) and you explicitly include it for javadoc generation via dependencySourceIncludes, it won't be included. The problem here is the dependency resolution with a filter: The ArtifactResolver uses the filter to check the whole dependency trail of an artifact (and not just the artifact itself), thus the current project must also be included by the filter or no dependencies of it will be resolved by the ArtifactResolver. However, the current project is not a dependency of the current project, it is the same and thus not explicitly included by dependencySourceIncludes. This means the filter must be modified for dependency resolution to always include the current project artifact.

      3) includeTransitiveDependencySources does not work as expected: The name of this property implies that not only the current project's dependencies, but also all transitive dependencies are added for javadoc generation. However, currently this property is only passed on to the PatternIncludesArtifactFilter and/or the PatternExcludesArtifactFilter, which is wrong and actually breaks the include/exclude mechanism if it is set to false (unfortunately the default value).

      I will attach an integration test showing the issues described and a patch solving this issue.

        Issue Links

          Activity

            People

            • Assignee:
              Mark Struberg
              Reporter:
              Jakob Korherr
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development