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

enable internal/external dependency references as links

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.6
    • Labels:
      None
    • Number of attachments :
      2

      Description

      This patch enables the java doc plugin to autmaticaly connect the dependent javadoc pages as links.
      There is no more need to add links in your pom's for internal and external maven projects.

      The plugin resolves the dependencies and adds the defined project url's extended with "/apidocs" to the links in the plugin.

      TODO: a warning occures when the project has no javadocs (or no maven generated javadoc on its homepage) ......

      1. maven-javadoc-plugin-2.1.patch
        15 kB
        Richard van Nieuwenhoven
      2. MJAVADOC-97-maven-javadoc-plugin.patch
        2 kB
        Matthew Beermann

        Issue Links

          Activity

          Hide
          Carlos Sanchez added a comment -

          this patch needs more work

          • must be 1.4 compatible
          • no need to reresolve the projects, the javadoc plugin already does, maybe you need to add a variable with the artifacts like compiler plugin does to build the classpath so they are available later
          Show
          Carlos Sanchez added a comment - this patch needs more work must be 1.4 compatible no need to reresolve the projects, the javadoc plugin already does, maybe you need to add a variable with the artifacts like compiler plugin does to build the classpath so they are available later
          Hide
          Richard van Nieuwenhoven added a comment -

          i know it is not the best solution but i needed a solution fast, any volunteers on beatifying this "nessesary" feature.

          maybe somewone can comine the effort with the xref generation, to solve the same problem for both projects

          Show
          Richard van Nieuwenhoven added a comment - i know it is not the best solution but i needed a solution fast, any volunteers on beatifying this "nessesary" feature. maybe somewone can comine the effort with the xref generation, to solve the same problem for both projects
          Hide
          Matthew Beermann added a comment -

          Here's another, much more concise patch that I'm fairly sure accomplishes the same thing.

          Show
          Matthew Beermann added a comment - Here's another, much more concise patch that I'm fairly sure accomplishes the same thing.
          Hide
          Cleber Zarate added a comment -

          Matthew, this code is using the project's url as the maven site. However, there are some cases where the project site is different from the generated maven site.
          So I changed the code to use the distributionManagement site. If the project doesn't have one, them attempts to use the project's website.
          Here's the code:
          @2575
          if (model != null)
          {
          String site;
          if(model.getDistributionManagement()!=null && model.getDistributionManagement().getSite() !=null)

          { String url = model.getDistributionManagement().getSite().getUrl(); if(url.indexOf("http://")>=0) site = url.substring(url.indexOf("http://")); //FIXME: make sure every site url will be http. else site = url; }

          else if(model.getUrl() != null)
          site = model.getUrl(); //attempts to use the project's url.

          addArgIfNotEmpty(arguments, "-link", JavadocUtil
          .quotedPathArgument(site + "/apidocs"),
          true); //TODO: fix the getUrl() method to return the URL with the version.
          }

          I'm using the substring since there's another protocol (dav being used for uploading the website. Maybe there's a better solution for that.

          Note that these patches won't work with dependencies that doesn't follow maven conventions for the site (for instance, hibernate uses http://www.hibernate.org/hib_docs/v3/api/ ).

          Show
          Cleber Zarate added a comment - Matthew, this code is using the project's url as the maven site. However, there are some cases where the project site is different from the generated maven site. So I changed the code to use the distributionManagement site. If the project doesn't have one, them attempts to use the project's website. Here's the code: @2575 if (model != null) { String site; if(model.getDistributionManagement()!=null && model.getDistributionManagement().getSite() !=null) { String url = model.getDistributionManagement().getSite().getUrl(); if(url.indexOf("http://")>=0) site = url.substring(url.indexOf("http://")); //FIXME: make sure every site url will be http. else site = url; } else if(model.getUrl() != null) site = model.getUrl(); //attempts to use the project's url. addArgIfNotEmpty(arguments, "-link", JavadocUtil .quotedPathArgument(site + "/apidocs"), true); //TODO: fix the getUrl() method to return the URL with the version. } I'm using the substring since there's another protocol (dav being used for uploading the website. Maybe there's a better solution for that. Note that these patches won't work with dependencies that doesn't follow maven conventions for the site (for instance, hibernate uses http://www.hibernate.org/hib_docs/v3/api/ ).
          Hide
          Matthew Beermann added a comment -

          I specifically avoided that approach, since it assumes a) that the project is using WebDAV to deploy the site, and b) that the publishing URL is the same as the public access URL. Those both seem like very large assumptions; larger, in my view, than the assumption about the <url> field...

          Show
          Matthew Beermann added a comment - I specifically avoided that approach, since it assumes a) that the project is using WebDAV to deploy the site, and b) that the publishing URL is the same as the public access URL. Those both seem like very large assumptions; larger, in my view, than the assumption about the <url> field...
          Hide
          Tuomas Kiviaho added a comment -

          Since it is highly unlikely that POM will ever have a javadoc location in the future <http://jira.codehaus.org/browse/MNG-2198> (although this feature would have made a good use of it) I suggest that URL resolving is made pluggable with either of the suggested methods as default. Manual listing of link/linkoffline becomes quite tedious and break easily

          Show
          Tuomas Kiviaho added a comment - Since it is highly unlikely that POM will ever have a javadoc location in the future < http://jira.codehaus.org/browse/MNG-2198 > (although this feature would have made a good use of it) I suggest that URL resolving is made pluggable with either of the suggested methods as default. Manual listing of link/linkoffline becomes quite tedious and break easily
          Hide
          Vincent Siveton added a comment -

          Fixed in r795801

          I added two new parameters: detectLinks and detectOfflineLinks
          Using detectlinks parameter, it tries to add dependencies Javadoc links, ie if you have

          <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
           </dependency>
          

          The added Javadoc link will be http://commons.apache.org/lang/apidocs.

          Using detectOfflineLinks, all modules javadoc dirs are added as offlinelinks.

          Show
          Vincent Siveton added a comment - Fixed in r795801 I added two new parameters: detectLinks and detectOfflineLinks Using detectlinks parameter, it tries to add dependencies Javadoc links, ie if you have <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </dependency> The added Javadoc link will be http://commons.apache.org/lang/apidocs . Using detectOfflineLinks, all modules javadoc dirs are added as offlinelinks.

            People

            • Assignee:
              Vincent Siveton
              Reporter:
              Richard van Nieuwenhoven
            • Votes:
              10 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: