Generated Java client (okhttp-gson) fails to build, erroring out on javadoc issues. This is reproducible even on samples/client/petstore/java/okhttp-gson for me. The output of mvn package is as follows:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project petstore-okhttp-gson: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
[ERROR] /Users/slavek.kabrda/programming/openapi-generator/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java:64: error: attribute not supported in HTML5: summary
[ERROR] <table summary="Response Details" border="1">
[ERROR] ^
# and many more error lines repeating the "table summary" error
It seems that there are 2 separate issues - the "table summary" being incorrect for HTML 5 and the other: "The code being documented uses modules but the packages defined in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module."
Seems to be both in 4.0.2 and current master.
Use the one included in samples.
None, just trying to build samples/client/petstore/java/okhttp-gson after cloning the repo.
$ cd samples/client/petstore/java/okhttp-gson
$ mvn package
None AFAICS.
For the first problem ("table summary"), we could probably easily fix the HTML to produce something that is compatible with HTML 5.
For the other issue, I guess the problem is a version combination of my JDK/maven, but I'm not a Java expert, so I don't know. Quick googling around didn't really help. My environment:
$ mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
Maven home: /usr/local/Cellar/maven/3.6.1/libexec
Java version: 12.0.1, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home
Default locale: en_CZ, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"
I couldn't repeat the issue locally (as I'm using Java 8). I'll leverage the CI to test different versions of JVM later to see if the issue occurs for a specified JVM version.
For the time being, please use -Dmaven.javadoc.skip=true as a workaround
FTR, I could only reproduce the issue using OpenJDK 11 and 12 from adoptopenjdk [1]. With their OpenJDK 8, this works fine for me too.
~Possible duplicate issue: #3299.~
~I think I have fixed it with https://github.com/OpenAPITools/openapi-generator/pull/3302~
~Can you give 4.0.3 a try?~
Can you provide what the correct HTML should be? It is easy to change.
In #3302 I have activated verification of Javadoc task in our CI, but I guess we are only testing with Java 8.
I need to check with @wing328 how we can run mvn --quiet javadoc:javadoc -Psamples.circleci on Java 11.
The configuration below of the javadoc plugin works for me with AdoptOpenJDK 11.0.6:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<source>8</source>
<doclint>none</doclint>
<tags>
<tag>
<name>http.response.details</name>
<placement>a</placement>
<head>Http Response Details:</head>
</tag>
</tags>
</configuration>
</plugin>
<source>8</source> property<doclint>none</doclint> property
Most helpful comment
The configuration below of the javadoc plugin works for me with AdoptOpenJDK 11.0.6:
<source>8</source>property<doclint>none</doclint>property