How to specify a different version of the Standard DocLet in Maven?

1.1k Views Asked by At

Background: I have a project that compiles fine with maven in a machine with java 1.7.0, but the javadoc compilation fails in another machine, which has java 1.8.0. From the log of maven, I can see that one is using the "Standard DocLet version 1.7.0_40", while the other is using "Standard DocLet version 1.8.0".

The question is: How can I tell maven to use the correct version of the Standard DocLet?

I've already set the source code and target version both to 1.7 in the maven-compiler-plugin.

2

There are 2 best solutions below

1
On

I would suggest to take a look into the documentation of maven-javadoc-plugin which describes as you should define the version for the doclets.

<project>
  ...
  <reporting> (or <build>)
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
          <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>

          <!-- <docletPath>/path/to/UmlGraph.jar</docletPath> -->
          <docletArtifact>
            <groupId>org.umlgraph</groupId>
            <artifactId>doclet</artifactId>
            <version>5.1</version>
          </docletArtifact>
          <additionalparam>-views</additionalparam>
          <useStandardDocletOptions>true</useStandardDocletOptions>
        </configuration>
      </plugin>
    ...
    </plugins>
  </reporting> (or </build>)
  ...
</project>
0
On

Having also hit an issue with this I dug into the maven-javadoc-plugin code and I don't think you can change the standard doclet version. You can specify a custom doclet but for the standard doclet it uses your java version, presumably because the doclet implementation is part of your JDK.