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

Generated javadoc.bat fails to execute in Windows10

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.2.0
    • None
    • javadoc
    • None

    Description

      In Windows10, I am consistently having this error generated:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.2.0:jar (attach-javadocs) on project work: MavenReportException: Error while generating Javadoc:
      [ERROR] Exit code: 1 - javadoc: error - cannot read options (The system cannot find the file specified)
      [ERROR]
      [ERROR] Command line was: cmd.exe /X /C "C:\java\x64\1.8.0-282-openjdk\jre\..\bin\javadoc.exe @options @argfile"
      [ERROR]
      [ERROR] Refer to the generated Javadoc files in 'C:\projects\scratch\work\target\apidocs' dir. 

       

      scratch.zip

      Extract the contents of the attached scratch.zip into Windows10, then simply run `mvn clean package` from the scratch directory, and you get the above error.

      The error is not generated in Linux.

      Investigations done

      When `mvn clean package` fails in Windows10, if you change directory target\apidocs and run the generated javadoc.bat file directly, you get the exact same error above:

      C:\projects\scratch\work\target\apidocs>
      C:\projects\scratch\work\target\apidocs>javadoc.bat
      
      C:\projects\scratch\work\target\apidocs>cmd.exe /X /C "C:\java\x64\1.8.0-282-openjdk\jre\..\bin\javadoc.exe @options @argfile"
      javadoc: error - cannot read options (The system cannot find the file specified)
      1 error 

       

      If I then modify the generated javadoc.bat file so that, instead of having this:

      cmd.exe /X /C "C:\java\x64\1.8.0-282-openjdk\jre\..\bin\javadoc.exe @options @argfile" 

      you replace it with this: 

      cmd.exe /X /C "cd C:\projects\scratch\work\target\apidocs && C:\java\x64\1.8.0-282-openjdk\jre\..\bin\javadoc.exe @options @argfile"

      ... essentially ensuring the current and working directory of the shell executed by cmd.exe is that apidocs directory, then execute javadoc.bat again, the issue is resolved :

      C:\projects\scratch\work\target\apidocs>cmd.exe /X /C "cd C:\projects\scratch\work\target\apidocs && C:\java\x64\1.8.0-282-openjdk\jre\..\bin\javadoc.exe @options @argfile"
      Loading source file C:\projects\scratch\work\src\main\java\org\examples\Bar.java...
      Loading source file C:\projects\scratch\work\src\main\java\org\examples\Foo.java...
      Constructing Javadoc information...
      Standard Doclet version 1.8.0_282
      Building tree for all the packages and classes...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\Bar.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\Foo.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\package-frame.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\package-summary.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\package-tree.html...
      Generating C:\projects\scratch\work\target\apidocs\constant-values.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\class-use\Bar.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\class-use\Foo.html...
      Generating C:\projects\scratch\work\target\apidocs\org\examples\package-use.html...
      Building index for all the packages and classes...
      Generating C:\projects\scratch\work\target\apidocs\overview-tree.html...
      Generating C:\projects\scratch\work\target\apidocs\index-all.html...
      Generating C:\projects\scratch\work\target\apidocs\deprecated-list.html...
      Building index for all classes...
      Generating C:\projects\scratch\work\target\apidocs\allclasses-frame.html...
      Generating C:\projects\scratch\work\target\apidocs\allclasses-noframe.html...
      Generating C:\projects\scratch\work\target\apidocs\index.html...
      Generating C:\projects\scratch\work\target\apidocs\help-doc.html... 

       

      This seems to be due to the way in Windows10 what the default directory is when cmd.exe is executed, which is slightly different compared to Windows7, which I also posted the  question to stackoverflow:

      https://stackoverflow.com/questions/66165972/windows10-cmd-exe-default-directory-different-to-windows7

      Suggested fix

      If the detected operation system is Windows10, add a "cd ..." command to ensure that javadoc.exe is executed from the correct directory.

       

      Attachments

        1. scratch.zip
          4 kB
          Jesus Salvo

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jmsjr Jesus Salvo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: