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.29k stars 6.44k forks source link

[BUG] Unable to build project on MacOS #19289

Open ckeshava opened 1 month ago

ckeshava commented 1 month ago

Bug Report Checklist

Description

Unable to complete mvn clean install on the project. However, I am able to successfully execute mvn clean package

openapi-generator version

I'm building the master branch at the tip of commit 484b87f22a79779ec75f04a672175b702cad7fea

Steps to reproduce
  1. Clone the git repository, checkout the master branch.
  2. Install the specified versions of dependencies. Here is the information about the environment: image

Observed error log: install-error-log.txt

Related issues/PRs

I could not find related issues. However, other developers have stumbled across this issue, albeit unsuccessfully. Here is a reference to a similar bug (referencing different gradle version) in a README file.

Suggest a fix

This appears to be a mismatch between the gradle version and the java runtime, but I don't know how to fix that. I'd like to draw your attention to this snippet from the above error log:

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Users/ckeshavabs/openapi-generator/modules/openapi-generator-gradle-plugin/settings.gradle' (/Users/ckeshavabs/.gradle/caches/7.6.4/scripts/qtv78r5dx5edqhhhf13bv6o).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org
wing328 commented 1 month ago

for JDK 21, please use mvn clean install -DskipTests

ckeshava commented 1 month ago

Hello @wing328 , I tried your suggestion, but I hit a similar error. Here is a relevant snippet:

[INFO] --- gradle:1.0.8:invoke (default) @ openapi-generator-gradle-plugin-mvn-wrapper ---
[INFO] jvmArgs: [Ljava.lang.String;@3f184abb
[INFO] gradleProjectDirectory: /Users/ckeshavabs/openapi-generator/modules/openapi-generator-gradle-plugin
[INFO] Build
[INFO] Starting Gradle Daemon
[INFO] Connecting to Gradle Daemon
[INFO] Starting Gradle Daemon
[INFO] Build
[INFO] Run build
[INFO] Evaluate settings
[INFO] Compiling settings file 'settings.gradle'
[INFO] Evaluate settings
[INFO] Run build

FAILURE: Build failed with an exception.

[INFO] Build
[INFO] Cleaning VCS Checkout Cache (/Users/ckeshavabs/openapi-generator/modules/openapi-generator-gradle-plugin/.gradle/vcs-1)
[INFO] Build
[INFO] Deleting unused version-specific caches in /Users/ckeshavabs/openapi-generator/modules/openapi-generator-gradle-plugin/.gradle
[INFO] Build
* What went wrong:
Could not open settings generic class cache for settings file '/Users/ckeshavabs/openapi-generator/modules/openapi-generator-gradle-plugin/settings.gradle' (/Users/ckeshavabs/.gradle/caches/7.6.4/scripts/qtv78r5dx5edqhhhf13bv6o).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openapi-generator-project 7.8.0-SNAPSHOT:
[INFO] 
[INFO] openapi-generator-project .......................... SUCCESS [  1.921 s]
[INFO] openapi-generator-core ............................. SUCCESS [  0.966 s]
[INFO] openapi-generator (core library) ................... SUCCESS [  9.379 s]
[INFO] openapi-generator (executable) ..................... SUCCESS [  2.908 s]
[INFO] openapi-generator (maven-plugin) ................... SUCCESS [  2.002 s]
[INFO] openapi-generator-gradle-plugin (maven wrapper) .... FAILURE [  3.455 s]
[INFO] openapi-generator-online ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.849 s
[INFO] Finished at: 2024-08-05T11:30:21-07:00
[INFO] ------------------------------------------------------------------------
[INFO] 104 goals, 84 executed, 20 from cache, saving at least 20s
[INFO] Cleaning up the local build cache...
[INFO] Deleted 0 unused files from the local build cache in 0.002s
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.fortasoft:gradle-maven-plugin:1.0.8:invoke (default) on project openapi-generator-gradle-plugin-mvn-wrapper: org.gradle.tooling.BuildException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.6.4-bin.zip'. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :openapi-generator-gradle-plugin-mvn-wrapper