-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Missing dependencies in java generator #5690
Comments
I am also facing this issue 👍 |
@jhandguy If you need a temporary workaround, you just have to add the following lines to the generated gradle project: dependencies {
compile "org.openapitools:jackson-databind-nullable:0.2.1"
} If you need to automate this task because the client project is automatically generated and built from other gradle parent project, you can include this within the task of the parent project that needs to use the openapi gradle subproject: doFirst {
// Fix for issue: https://github.com/OpenAPITools/openapi-generator/issues/5690
def f = new File("$generatedSubproject/build.gradle")
f.append("""
dependencies {
compile "org.openapitools:jackson-databind-nullable:0.2.1"
}
""")
} |
I also encountered the same issue with OpenAPI generator v4.3.0 in a Spring Boot project. It could be reproduced by using the Pet API and the following plugin configuration:
So the same issue also applies to spring generator. I would be happy to create a separate bug report if needed. |
can you please submit a PR to start with? would be great if you can use moving forward, it will be better to test it in the CI so as to catch the issue moving forward. |
Doing some more investigation, looking at the blame log it seems that the template snippet for I've created a sample project https://github.com/kierans/openapi-generator-java-sample |
For those using Gradle here's a quick snippet to see what's on the task dumpScriptClasspath {
doLast {
buildscript.configurations.classpath.each { println it }
}
} |
This should be fix by #2901 . In the attached PR, I add a property to remove I also try to add this dependency in the generated |
I'm seeing this issue using #2901 appears to just be cleaning up this import is not used. Model generation is still failing if properties are flagged with |
@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 In the future release of openapi-generator (the 5.0.0), this should be fix. |
I'm playing around with latest version 4 and
|
Now I'm trying
|
I tested |
@black-snow I've filed #7777 to fix the missing dependency issue in Java |
If there's still an issue with missing dependencies, please PM me via Slack channel, which can be found in the project's README. |
Could this issue be reworded to "Plugin tries to compile the separate generated project when it should only generate the project"? |
@scothale could you elaborate that? |
Just wanted to note, that this issue might still occur in the JavaJaxRS code generator, when no |
Still facing |
This is still an issue in 7.3.0 but can be solved with the property: |
Why is this issue closed? The bug is still there. Although |
With |
Bug Report Checklist
Description
When I try to run the generated gradle, some dependencies are missing. I get some errors like the following:
Which is solved by adding the following line to the
dependencies
section:This is the configuration of the gradle task that generates the failing gradle script:
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:
#3793
Suggest a fix
N/A
The text was updated successfully, but these errors were encountered: