Uploaded image for project: 'Maven Javadoc Plugin'
  1. Maven Javadoc Plugin
  2. MJAVADOC-646

Look for javadoc binary in the PATH as well

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.2.0
    • None
    • javadoc
    • None

    Description

      Currently, the maven-javadoc-plugin tries to locate the javadoc binary as follows:

      • either the path to the javadoc executable has been set by the user in the configuration;
      • or we look for it in the directory designated by the `java.home` system property
      • or we look for it in the directory designated by the `JAVA_HOME` environment variable

      If none of these work, we fail with the message "Unable to find javadoc command".

      In some environments, such as on Debian Sid with OpenJDK 12, the JAVA_HOME property is not used by default and the javadoc binary is actually located in the PATH, at `/usr/bin/javadoc`. This is a problem: as a user, my options are to manually symlink that javadoc into the installation folder of the JDK (not great) or write down the `/usr/bin/javadoc` path in the plugin's configuration (which is going to lead to failures in other environments).

      This problem seems to be fairly common:

      https://stackoverflow.com/questions/13961615/unable-to-find-javadoc-command-maven

      https://stackoverflow.com/questions/49472783/maven-is-unable-to-find-javadoc-command

      https://mail-archives.apache.org/mod_mbox/maven-dev/202003.mbox/browser

      Therefore I propose to adapt to look for the javadoc binary in the PATH as a last resort attempt, before failing.

      I can do a pull request for this if given the assurance that this is something you would be happy to have.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pintoch Antonin Delpeuch
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: