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

Cannot generate Javadoc on Mac OS X if path contains space characters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.5
    • Labels:
      None
    • Environment:
      Maven version: 2.0.7
      Java version: 1.5.0_07
      OS name: "mac os x" version: "10.4.10" arch: "i386"

      Description

      Running 'mvn javadoc:javadoc' fails if the path to the current directory contains a space character. It works with the 2.0 version of the plugin. It also works if I rename the directory so that it does not contain a space character.

      presley:~/Documents/workarea/Elk API clabu$ mvn -e javadoc:javadoc
      + Error stacktraces are turned on.
      [INFO] Scanning for projects...
      [INFO] Searching repository for plugin with prefix: 'javadoc'.
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building The Elk Framework
      [INFO] task-segment: [javadoc:javadoc] (aggregator-style)
      [INFO] ----------------------------------------------------------------------------
      [INFO] Preparing javadoc:javadoc
      [INFO] ----------------------------------------------------------------------------
      [INFO] Building The Elk Framework
      [INFO] ----------------------------------------------------------------------------
      [INFO] No goals needed for project - skipping
      [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
      [INFO] Setting property: velocimacro.messages.on => 'false'.
      [INFO] Setting property: resource.loader => 'classpath'.
      [INFO] Setting property: resource.manager.logwhenfound => 'false'.
      [INFO] **************************************************************
      [INFO] Starting Jakarta Velocity v1.4
      [INFO] RuntimeInstance initializing.
      [INFO] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
      [INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
      [INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
      [INFO] ClasspathResourceLoader : initialization starting.
      [INFO] ClasspathResourceLoader : initialization complete.
      [INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
      [INFO] Default ResourceManager initialization complete.
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
      [INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
      [INFO] Created: 20 parsers.
      [INFO] Velocimacro : initialization starting.
      [INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
      [ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
      [INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
      [INFO] Velocimacro : VM library template macro registration complete.
      [INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
      [INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
      [INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
      [INFO] Velocimacro : initialization complete.
      [INFO] Velocity successfully started.
      [INFO] [javadoc:javadoc]
      1 error
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - cannot read options (No such file or directory)

      Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc" @options @packages

      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - cannot read options (No such file or directory)

      Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc" @options @packages
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:224)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - cannot read options (No such file or directory)

      Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc" @options @packages
      at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:233)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
      ... 16 more
      Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 1 - javadoc: error - cannot read options (No such file or directory)

      Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc" @options @packages
      at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1407)
      at org.apache.maven.plugin.javadoc.JavadocReport.generate(JavadocReport.java:131)
      at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:219)
      ... 18 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3 seconds
      [INFO] Finished at: Wed Sep 05 23:28:49 CEST 2007
      [INFO] Final Memory: 6M/12M
      [INFO] ------------------------------------------------------------------------

        Issue Links

          Activity

          Hide
          Siveton Vincent added a comment -

          Could you send us the options and packages files? You need to add -Ddebug=true.
          http://maven.apache.org/plugins/maven-javadoc-plugin/faq.html#How%20to%20know%20exactly%20the%20Javadoc%20command%20line

          Show
          Siveton Vincent added a comment - Could you send us the options and packages files? You need to add -Ddebug=true. http://maven.apache.org/plugins/maven-javadoc-plugin/faq.html#How%20to%20know%20exactly%20the%20Javadoc%20command%20line
          Hide
          Benjamin Bentmann added a comment - - edited

          Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 1 - javadoc: error - cannot read options (No such file or directory)

          I do not believe that the options file is the trouble maker, it is not found by javadoc.

          Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && ..." @options @packages

          To me, it seems rather like a problem with Plexus' CommandLineUtils and related classes. From MJAVADOC-127 I noticed that the shell in question for the Mac environment here might be the org.codehaus.plexus.util.cli.shell.BourneShell. Now, look at its source:

              public String getExecutable()
              {
                  File wd = getWorkingDirectory();
          
                  if ( wd != null )
                  {
                      String path = getWorkingDirectory().getAbsolutePath();
                      String exe = super.getExecutable();
                      return "cd " + handleQuote( path ) + " && " + handleQuote( exe );
                  }
                  else
                  {
                      return super.getExecutable();
                  }
              }

          They do not seem to care about spaces in the pathes. I am not sure, but it could result in the effective command working directory "/Users/clabu/Documents/workarea/Elk", where no options or package files exist.

          Show
          Benjamin Bentmann added a comment - - edited Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 1 - javadoc: error - cannot read options (No such file or directory) I do not believe that the options file is the trouble maker, it is not found by javadoc. Command line was:"cd /Users/clabu/Documents/workarea/Elk API/target/site/apidocs && ..." @options @packages To me, it seems rather like a problem with Plexus' CommandLineUtils and related classes. From MJAVADOC-127 I noticed that the shell in question for the Mac environment here might be the org.codehaus.plexus.util.cli.shell.BourneShell. Now, look at its source: public String getExecutable() { File wd = getWorkingDirectory(); if ( wd != null ) { String path = getWorkingDirectory().getAbsolutePath(); String exe = super .getExecutable(); return "cd " + handleQuote( path ) + " && " + handleQuote( exe ); } else { return super .getExecutable(); } } They do not seem to care about spaces in the pathes. I am not sure, but it could result in the effective command working directory "/Users/clabu/Documents/workarea/Elk", where no options or package files exist.
          Hide
          Tom Purcell added a comment -

          I'm having the same issue on 2 different versions of Linux (RedHat AS4 & Suse 10.2) with version 2.4 of the plugin. If I use the 2.0 version the problem does not occur.

          Show
          Tom Purcell added a comment - I'm having the same issue on 2 different versions of Linux (RedHat AS4 & Suse 10.2) with version 2.4 of the plugin. If I use the 2.0 version the problem does not occur.
          Hide
          Siveton Vincent added a comment -

          It seems to be related to PLXUTILS-64.
          I already bumped p-u to 1.5.1. Could you retry with javadoc plugin 2.5-SNAPSHOT?

          Show
          Siveton Vincent added a comment - It seems to be related to PLXUTILS-64. I already bumped p-u to 1.5.1. Could you retry with javadoc plugin 2.5-SNAPSHOT?
          Hide
          Brett Porter added a comment -

          the changes work for me, however I now see a test failure in testQuotedPath on trunk:

          -------------------------------------------------------------------------------
          Test set: org.apache.maven.plugin.javadoc.JavadocReportTest
          -------------------------------------------------------------------------------
          Tests run: 20, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 30.902 sec <<< FAILURE!
          testQuotedPath(org.apache.maven.plugin.javadoc.JavadocReportTest)  Time elapsed: 0.927 sec  <<< ERROR!
          org.apache.maven.plugin.MojoExecutionException: An error has occurred in JavaDocs report generation:Exit code: 2 - /bin/sh: -c: line 0: unexpected EOF
           while looking for matching `''
          /bin/sh: -c: line 1: syntax error: unexpected end of file
          Command line was:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc @options @argfile
                  at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:226)
                  at org.apache.maven.plugin.javadoc.JavadocReportTest.testQuotedPath(JavadocReportTest.java:517)
          Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 2 - /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
          /bin/sh: -c: line 1: syntax error: unexpected end of file
          Command line was:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc @options @argfile
                  at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1674)
                  at org.apache.maven.plugin.javadoc.JavadocReport.generate(JavadocReport.java:127)
                  at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:222)
                  ... 27 more
          
          Show
          Brett Porter added a comment - the changes work for me, however I now see a test failure in testQuotedPath on trunk: ------------------------------------------------------------------------------- Test set: org.apache.maven.plugin.javadoc.JavadocReportTest ------------------------------------------------------------------------------- Tests run: 20, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 30.902 sec <<< FAILURE! testQuotedPath(org.apache.maven.plugin.javadoc.JavadocReportTest) Time elapsed: 0.927 sec <<< ERROR! org.apache.maven.plugin.MojoExecutionException: An error has occurred in JavaDocs report generation:Exit code: 2 - /bin/sh: -c: line 0: unexpected EOF while looking for matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file Command line was:/ System /Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc @options @argfile at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:226) at org.apache.maven.plugin.javadoc.JavadocReportTest.testQuotedPath(JavadocReportTest.java:517) Caused by: org.apache.maven.reporting.MavenReportException: Exit code: 2 - /bin/sh: -c: line 0: unexpected EOF while looking for matching `'' /bin/sh: -c: line 1: syntax error: unexpected end of file Command line was:/ System /Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/javadoc @options @argfile at org.apache.maven.plugin.javadoc.AbstractJavadocMojo.executeReport(AbstractJavadocMojo.java:1674) at org.apache.maven.plugin.javadoc.JavadocReport.generate(JavadocReport.java:127) at org.apache.maven.plugin.javadoc.JavadocReport.execute(JavadocReport.java:222) ... 27 more
          Hide
          Siveton Vincent added a comment -

          I updated p-u to 1.5.2-SNAPSHOT in r663590, snapshot deployed.

          Could you retry with javadoc plugin 2.5-SNAPSHOT?

          Show
          Siveton Vincent added a comment - I updated p-u to 1.5.2-SNAPSHOT in r663590, snapshot deployed. Could you retry with javadoc plugin 2.5-SNAPSHOT?
          Hide
          Vincent Ricard added a comment -

          I've also the bug (linux platform, bash shell) with the 2.4 version. I just now tested the 2.5-SNAPSHOT version, and all is fine for the 'bug of the space'
          Thx

          Show
          Vincent Ricard added a comment - I've also the bug (linux platform, bash shell) with the 2.4 version. I just now tested the 2.5-SNAPSHOT version, and all is fine for the 'bug of the space' Thx
          Hide
          Arnaud HERITIER added a comment -

          This issue is fixed with the update of plexus-util

          Show
          Arnaud HERITIER added a comment - This issue is fixed with the update of plexus-util
          Hide
          Trevor Harmon added a comment -

          I was having the bug in Maven 2.0.9 in this configuration:

          <reporting>
          <plugins>
          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          </plugins>
          </reporting>

          Simply forcing the 2.5 version fixed the problem for me:

          <reporting>
          <plugins>
          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.5</version>
          </plugin>
          </plugins>
          </reporting>

          Show
          Trevor Harmon added a comment - I was having the bug in Maven 2.0.9 in this configuration: <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> </plugin> </plugins> </reporting> Simply forcing the 2.5 version fixed the problem for me: <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.5</version> </plugin> </plugins> </reporting>
          Hide
          Arun K Viswanathan added a comment -

          I had the same error on Windows with both Maven 2.0.9 and Maven 2.2.1. Forcing maven-javadoc-plugin to 2.5 didn't help.

          I had added a Autorun key in the Windows registry under HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor and set it to "cd /d d:\MyWorkDir" so that it would set my default directory whenever I start a Command Prompt. This was interfering with Maven's shell creation by changing the starting directory for the shell, leading to the "cannot read options" error. Removing the Autorun key fixed the problem.

          Show
          Arun K Viswanathan added a comment - I had the same error on Windows with both Maven 2.0.9 and Maven 2.2.1. Forcing maven-javadoc-plugin to 2.5 didn't help. I had added a Autorun key in the Windows registry under HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor and set it to "cd /d d:\MyWorkDir" so that it would set my default directory whenever I start a Command Prompt. This was interfering with Maven's shell creation by changing the starting directory for the shell, leading to the "cannot read options" error. Removing the Autorun key fixed the problem.

            People

            • Assignee:
              Siveton Vincent
              Reporter:
              Claes Buckwalter
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development