OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.86k stars 6.59k forks source link

[BUG] Build failure with OpenJDK 16 #9817

Open nathany-copia opened 3 years ago

nathany-copia commented 3 years ago

Bug Report Checklist

Description

I would like to contribute to openapi-generator's language support, but I'm not very familiar with Java, and the build is failing on my system.

❯ mvn clean install -e

[INFO] Running TestSuite
Configuring TestNG with: TestNG60Configurator
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.instrument.IllegalClassFormatException: Error while instrumenting sun/util/resources/provider/NonBaseLocaleDataMetaInfo.
    at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:94)
...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.0:jar (attach-javadocs) on project openapi-generator-core: MavenReportException: Error while generating Javadoc: Project contains Javadoc Warnings -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.0:jar (attach-javadocs) on project openapi-generator-core: MavenReportException: Error while generating Javadoc: Project contains Javadoc Warnings
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
openapi-generator version

master (2e85ccdec8c3304e42c3434ef6da54a637a13e1a)

OpenAPI declaration file content or url
Generation Details
Steps to reproduce
❯ java --version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
❯ mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /usr/local/Cellar/maven/3.8.1/libexec
Java version: 16.0.1, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/16.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "11.4", arch: "x86_64", family: "mac"
Related issues/PRs

9804 a different build error

Suggest a fix
nathany-copia commented 3 years ago

./run-in-docker.sh mvn package does work

wing328 commented 3 years ago

@anmlnath thanks for reporting the issue. Can you please try the following to skip javadoc as a workaround?

mvn clean package -Dmaven.javadoc.skip=true
nathany-copia commented 3 years ago

Thanks for the response.

Running mvn clean package -Dmaven.javadoc.skip=true reports a tonne of errors in the form:

java.lang.instrument.IllegalClassFormatException: Error while instrumenting org/openapitools/codegen/languages/PythonClientCodegen$MockitoMock$1700579199$auxiliary$BQ4PxCPc.
    at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:94)

Since the Docker package works, I assume this is something with my environment, like the Java JDK version?

wing328 commented 3 years ago

Right, we've not yet tested this project with JDK 16. Please use ./run-in-docker.sh mvn package for the time being.

Stokestack commented 2 years ago

Same experience here. Skipping JavaDoc doesn't solve it for me either. Java and Maven version info:

java version "1.8.0_341" Java(TM) SE Runtime Environment (build 1.8.0_341-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: /usr/local/Cellar/maven/3.8.6/libexec Java version: 18.0.2.1, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/18.0.2.1/libexec/openjdk.jdk/Contents/Home

The Docker option doesn't work, because although I have Docker installed, the script mentioned above fails with:

docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Aaaand this turns out to be a big PITA on Macs, which require a bunch of other stuff to run the Docker daemon, despite the fact that you can type "docker" at the command line and it spits out a bunch of info. Thus it would be really great to have the core problem fixed.