Search code examples
javamavenjavadoc

Maven build fails cause javadoc


I get an error while building a maven project (Java 8 update 40), but there should not be a javadoc problem, cause there is no javadoc:

[INFO] Constructing Javadoc information...
[INFO] 1 error
...
An error has occurred in JavaDocs report generation:
...
[INFO] [ERROR] bad class file: ...
...
undeclared type variable: D
...

Here the method:

public static <D extends Displayable> Provider<D> forDisplayable(
        final Function<D, Type> function) {
    return new Provider<>(d -> d.getDisplayName(), function);
}

What is going on?

Part of POM:

<pluginManagement>
  <plugins>
    ...
    <plugin>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>2.10.3</version>
    </plugin>
    ...
  </plugins>

Solution

  • I had a similar problem, but got no useful answer. In case you don't get one either here is what you can do to make it work:

    • either downgrade Java to 1.8.0_20 (maybe something above 1.8.0_60 will work; 1.8.0_31, 1.8.0_40, 1.8.0_45, 1.8.0_60 all don't work for me)
    • or add <maven.javadoc.skip>true</maven.javadoc.skip> in the properties of the pom.xml to disable JavaDoc