[BUG] Missing dependencies in java generator
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What’s the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What’s the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
When I try to run the generated gradle, some dependencies are missing. I get some errors like the following:
/path/File.java:xx: error: package org.openapitools.jackson.nullable does not exist
import org.openapitools.jackson.nullable.JsonNullableModule;
Which is solved by adding the following line to the dependencies section:
compile "org.openapitools:jackson-databind-nullable:0.2.1"
This is the configuration of the gradle task that generates the failing gradle script:
task openApiJavaClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "java"
inputSpec = specFile
outputDir = generatedSubproject
invokerPackage = "com.foo"
modelPackage = "com.foo"
configOptions = [
dateLibrary : "java8",
library : "native",
artifactId : "java-api-client",
artifactVersion: project.version,
java8 : "true",
]
systemProperties = [
modelDocs: "false"
]
}
javadoc {
failOnError = false
}
jar.dependsOn tasks.openApiJavaClient
openapi-generator version
4.2.3
OpenAPI declaration file content or url
N/A
Command line used for generation
./gradlew clean build
Steps to reproduce
./gradlew clean build
Related issues/PRs
It seems this issue was fixed in v4.1.2 but it happens again in v4.2.3:
https://github.com/OpenAPITools/openapi-generator/pull/3793
Suggest a fix
N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:15 (9 by maintainers)
Top Results From Across the Web
java - dependencies.dependency.version' is missing error
When I run mvn clean install command it is giving the below error: dependencies.dependency.version' is missing for javax.servlet:servlet-api.jar.
Read more >Missing dependencies - MPS Support | JetBrains
So, guys, i have the following errors. They are i'm sure from missing import of/dependency on/usage of j.m.baseLanguage.
Read more >Learning the Basics - Gradle User Manual
Gradle represents the scope of a dependency with the help of a Configuration. Every configuration can be identified by a unique name. Many...
Read more >Maven Error: Failed to collect dependencies - When trying to ...
It's possible your dependencies are corrupted in your local maven cache, you could try forcing an update of the maven dependency cache -...
Read more >Known issues with Android Studio and Android Gradle Plugin
JUnit tests missing resources in classpath when run from Android Studio ... If you have specific resource folders in your Java modules, then...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@black-snow I’ve filed https://github.com/OpenAPITools/openapi-generator/pull/7777 to fix the missing dependency issue in Java
webclientclient@gausnes : In fact, it is more than that.
The may objective of #2901 was to remove a jar (and also all associated imports) from the generated code. When I made this PR, I ensure that all dependencies was properly in the classpath (pom.xml or build.gradle) when you enable the property
openApiNullable. In this case, I noticed that the dependencies were missing and I added.In the future release of openapi-generator (the 5.0.0), this should be fix.