views:

466

answers:

2

When I run mvn javadoc:javadoc, I get the following error:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An error has occurred in JavaDocs report generation:Exit code: 1 -
javadoc: error - cannot read options (The system cannot find the file specified)

Command line was:"C:\Program Files\Java\jdk1.6.0_14\jre\..\bin\javadoc.exe"
 @options @packages

When I invoke the command "C:\Program Files\Java\jdk1.6.0_14\jre..\bin\javadoc.exe" on my system it runs the javadoc executable.

I am running:

  • JDK 1.6.0_14
  • Maven 2.0.8

The javadoc reporting part of my POM looks like:

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

And relevant environment variables:

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_14
M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-2.0.8
M2_REPO=C:\Documents and Settings\<user>\.m2\repository //<user> is my user
MAVEN_OPTS=-XX:MaxPermSize=128m -Xmx512m

I have tried reinstalling Java and Maven, as well as using Maven 2.1.0, JDK 1.6.0_11, and even JDK 1.5.0_11. I have compared my setup to a coworker who has practically the same environment but no problems. It used to work about a month ago, and no, I don't know what's changed on my system since then. I first encountered it with JDK 1.6.0_11. This happens on every project I've tried in our repository, and my coworkers have no problems with the same projects. So I'm pretty sure it's just my environment and not the projects themselves.

I would really appreciate any suggestions on this.

A: 

I believe the problem is that the javadoc command is being run without any parameters. I ran into this in one of my multi-module projects where it was trying to javadoc a non-java module. (The javadoc was being requested by the parent, pom.)

Does the module in question have javadocs to be made? We finally moved to maven 2.1.0 and I haven't seen the problem reoccur.

Are your other team members also using maven 2.0.8?

caskey
It happens both on multi-module and single module projects. On the multi-module project, it correctly skips over the parent project that contains no Java files and fails on the first module that contains Java files.Everyone else on the team is using 2.0.8, because when we set this up there was a problem with the release plugin in Maven 2.0.9. And I have tried installing 2.1.0 but I get the same error anyway.
dave4351
A: 

I figured it out, but first I tried various things:

  • Uninstalling every JDK and JRE on my system, and then reinstalling Java to a path with no spaces
  • Removing every environment variable I wasn't using, and cleaning up my PATH
  • Relocating Maven and my local repo to directories with no spaces
  • Rebooting (you never know, it's Windows)

Today I tried to run a batch file which didn't execute properly, and I quickly realized that when I double clicked on it, it was executing the file but not in the directory where it lived. And then it hit me.

A few weeks ago I got fed up with our IT guys forcing our cmd window to open at H: and so I Googled and used this page to "fix it". It seemed to work; I didn't have any problems for a few weeks and I had already forgotten that my cmd windows all used to open to some H: drive. But every single cmd window opened to a directory I specified--whether I ran "cmd" or clicked a batch file or if Maven opened a new cmd window...

I guess when Maven runs it shells out to execute the javadoc command. And so the javadoc part was working, but it couldn't find the options file it writes out because the working directory was wrong.

So, now I'm back on H: until I can figure that out. And then I'll screw something else up. But hopefully, if nothing else, this will help someone else...

dave4351