You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Antonin Delpeuch (Jira)" <ji...@apache.org> on 2020/03/25 08:27:00 UTC

[jira] [Created] (MJAVADOC-646) Look for javadoc binary in the PATH as well

Antonin Delpeuch created MJAVADOC-646:
-----------------------------------------

             Summary: Look for javadoc binary in the PATH as well
                 Key: MJAVADOC-646
                 URL: https://issues.apache.org/jira/browse/MJAVADOC-646
             Project: Maven Javadoc Plugin
          Issue Type: Improvement
          Components: javadoc
    Affects Versions: 3.2.0
            Reporter: Antonin Delpeuch


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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)