Goodmorning,
I am trying to generate an API client in Java with Open API. Sadly, it needs to work with java 6. I enable the flag, and everything works fine in the development environment (Eclipse) running on Java 11 with compliance for Java 6. When I export the JAR and try to run it in the staging environment with JRE 1.6, I get the error ClassDefNotFound okhttp3/Interceptor
. If I try to download this dependency from Maven I then get Unsupported major.minor version 52.0
.
So, I am wondering if the flag supportJava6 actually does something or not, since it seems like it requires at least Java 8.
Am I doing something wrong?
Best regards
UPDATE:
The API specs: https://api.civilianext.it/Protocollo/api/help/v1/docs
The API is authorized with client_ID and secret. I have made a small lib for the authorization, that works with Java6, so the auth is working and done.
What is not working is the API, at runtime usually (it compiles with some quick fixes).
I used both Swagger and OpenAPI, running locally in a docker.
BEWARE: I changed these files many times, I do not remember all combinations and configurations I tried. I do know I tried everything it was posted here in StackOverflow and even more, and nothing worked. I've been here for like a month trying everything when I have time.
These are the latest configurations I tried:
OpenAPI:
version: "3.6"
services:
openapi-codegen-cli:
image: openapitools/openapi-generator-cli:v4.3.1
volumes:
- '.:/local'
command: generate -g jaxrs-spec -i local/in/api.yml -o /local/out/jaxrs-client --additional-properties=dataLibrary=threetenbp,java8=false --skip-validate-spec
volumes:
openapi_data:
Swagger:
swagger-codegen-cli:
image: swaggerapi/swagger-codegen-cli
volumes:
- '.:/local'
command: generate -l java -i local/json/api.json -c local/config/config.json -o /local/out/java-client
// config.json
{
supportJava6: true,
}
Once the code is generated, I usually have to fix the pom.xml
, adding <pluginManagement>
tags. Then I build the project with mvn clean install
. The build compiles and I usually get some errors at runtime, about unsupported major.minor version.
I also tried this: https://github.com/OpenAPITools/openapi-generator/issues/8383