OpenApi Generator gradle plugin generates new gradle project
See original GitHub issueDescription
Hello!
I’m trying to generate code via OpenAPI Generator Gradle Plugin version 5.1.1 I can’t understand behavior of this plugin, it generates new gradle project, but not only kotlin classes
my task configuration is
openApiGenerate {
//verbose.set(true)
generatorName.set("kotlin")
outputDir.set(project.file("${buildDir.name}/generated").absolutePath)
inputSpec.set(project.file("schema/openapi.json").absolutePath)
packageName.set("org.camunda.bpm.engine.rest")
apiPackage.set("org.camunda.bpm.engine.rest.api")
modelPackage.set("org.camunda.bpm.engine.rest.model")
}
As far as i know, maven plugin generates just classes, not new project Looks like gradle plugins works as generator cli
Why openapi generator gradle plugin generates new project?
openapi-generator version
5.1.1
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:7 (1 by maintainers)
Top Results From Across the Web
openapi-generator/README.adoc at master - GitHub
This document describes the Gradle plugin for OpenAPI Generator. This Gradle plugin offers a declarative DSL via extensions (these are Gradle project ......
Read more >Plugins - OpenAPI Generator
A Maven plugin to support the OpenAPI generator project ... This gradle plugin offers a declarative DSL via extensions (these are Gradle ......
Read more >Generate Java Spring API from OpenAPI 3 - Stack Overflow
I followed OpenAPI generator gradle plugin doc doc. My build.gradle: plugins { id 'java-library' id "org.openapi.generator" version ...
Read more >org.openapi.generator - Gradle Plugin Portal
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI ...
Read more >How to Automate OpenAPI Client Code Generation in Spring ...
This tool allows developers to auto-generate client code segments by referring to the ... How to Define the Code Generation as a Gradle...
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 FreeTop 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
Top GitHub Comments
I second this. To this day I do not understand the purpose of the gradle plugin. One would expect this plugin to automatically include the generated code to
/src/gen/java
(not literally, but make the generated code part of a javasourceSet
) of the gradle project that uses the plugin, and also extend thecompileClasspath
configuration to include the necessary dependencies (like jackson and stuff). But in fact, the Gradle plugin is a very thin wrapper around the CLI. You can just as well call this directly viajavaExec
.To actually use the generated code inside your own gradle project, you have to do hacky stuff like
sourceSets.main.java.srcDir "${buildDir}/generated/src/main/java"
and also manually (!) copy the dependencies from the generated build.gradle file into your own.We have tens of developers in our company, and every single one of them misunderstands the purpose of the gradle plugin. All one of them, myself included, expect this plugin to make it so that the generated code becomes directly usable inside your own gradle project. But unfortunately, this is not the case.
Or like this for Kotlin: