OpenAPITools / OpenAPITools/openapi-generator
[BUG][Java][Spring] "gradlew openApiGenerate" does not work well version 5.0.0
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Hello :)
I could run gradlew openApiMeta but,"gradlew openApiGenerate" don't work well.
Then I checked the command "openApiGenerate" is enable to run "gradlew tasks" and found the command from task lists.
I wonder that is bug.
openapi-generator version
5.0.0
(version 4 work well)
OpenAPI declaration file content or url
build.gradle
buildscript {
ext {
springBootVersion = '2.1.5.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "org.openapitools:openapi-generator-gradle-plugin:5.0.0"
}
}
apply plugin: "org.springframework.boot"
apply plugin: "org.openapi.generator"
dependencies {
implementation('org.springframework.boot:spring-boot-starter-batch')
compileOnly('org.projectlombok:lombok:1.18.4')
annotationProcessor('org.projectlombok:lombok:1.18.4')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.batch:spring-batch-test')
}
openApiGenerate {
generatorName = "spring"
version = "1.0.0"
inputSpec = "$rootDir/specs/petstore-v3.0.yaml".toString()
outputDir = "$buildDir/generated".toString()
invokerPackage = "com.example"
apiPackage = "com.example.api"
modelPackage = "com.example.model"
configOptions = [
dateLibrary: "java8-localdatetime",
interfaceOnly: "true"
]
globalProperties = [
modelDocs: "false"
]
}
openApiMeta {
generatorName = "Sample"
packageName = "org.openapitools.example"
outputFolder = "$buildDir/meta".toString()
}
Generation Details
------------------------------------------------------------
Gradle 5.1
------------------------------------------------------------
Build time: 2019-01-02 18:57:47 UTC
Revision: d09c2e354576ac41078c322815cc6db2b66d976e
Kotlin DSL: 1.1.0
Kotlin: 1.3.11
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.2 (Amazon.com Inc. 11.0.
Steps to reproduce
- write build.gradle
- run ".\gradlew openApiMeta <- work well
- run ".\gradlew opemApiGenerate
.\gradlew openApiGenerate
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':openApiGenerate'.
> Cannot resolve object of unknown type String to a Task.
* 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 1s
I found that from "gradlew tasks"
.\gradlew tasks
------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------
Application tasks
-----------------
bootRun - Runs this project as a Spring Boot application.
Build tasks
-----------
assemble - Assembles the outputs of this project.
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'GenerateTemplate'.
components - Displays the components produced by root project 'GenerateTemplate'. [incubating]
dependencies - Displays all dependencies declared in root project 'GenerateTemplate'.
dependencyInsight - Displays the insight into a specific dependency in root project 'GenerateTemplate'.
dependencyManagement - Displays the dependency management declared in root project 'GenerateTemplate'.
dependentComponents - Displays the dependent components of components in root project 'GenerateTemplate'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'GenerateTemplate'. [incubating]
projects - Displays the sub-projects of root project 'GenerateTemplate'.
properties - Displays the properties of root project 'GenerateTemplate'.
tasks - Displays the tasks runnable from root project 'GenerateTemplate'.
OpenAPI Tools tasks
-------------------
openApiGenerate - Generate code via Open API Tools Generator for Open API 2.0 or 3.x specification documents.
openApiGenerators - Lists generators available via Open API Generators.
openApiMeta - Generates a new generator to be consumed via Open API Generator.
openApiValidate - Validates an Open API 2.0 or 3.x specification document.
Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.
Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied build.gradle and reproduce the failure using Gradle 5.1, Java 11, and openapi-generator-gradle-plugin 5.0.0. Compare the working openApiMeta task with openApiGenerate and inspect the reported dependency-resolution error. Done means openApiGenerate runs successfully and generates the configured output from the supplied OpenAPI specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100