Gradle 构建文件 org.openapi.generator openApiGenerate 列表生成器 openApiGenerators 无输出无错误

Gradle Build File org.openapi.generator openApiGenerate Listing Generators openApiGenerators No Output No Error

我的 build.gradle 文件中有以下配置

plugins {
    id 'java'
    id 'org.openapi.generator' version '4.1.3'
}

repositories {
    maven { url "https://mavenrepo.schwab.com/nexus/content/groups/public" }
    maven { url "https://mavenrepo.schwab.com/nexus/content/repositories/releases/" }
    mavenCentral()
    jcenter()
}

sourceSets.main.java.srcDirs += "$buildDir/generated/src/main/java"

openApiGenerate {
    generatorName = "java"
    inputSpec = "$rootDir/API/POMOrchestrator.v1.json".toString()
    outputDir = "$rootDir/application/".toString()
    apiPackage = "com.schwab.brokerage.party.onborading.api.inbound.rest.controller"
    invokerPackage = "com.schwab.brokerage.party.onborading"
    modelPackage = "com.schwab.brokerage.party.onborading.models.swagger"
    modelNamePrefix = "Party"
    configOptions = [
            dateLibrary: "java8-localdatetime"
    ]

}

compileJava.dependsOn tasks.openApiGenerate

当我执行以下命令时

gradle openApiGenerators --warning-mode all

我得到以下输出,没有错误(明显错误,因为我认为它不喜欢我的生成器名称),没有输出 类。

> Configure project :
Using method ObjectFactory.property() method to create a property of type Map<K, V> has been deprecated. This will fail with an error in Gradle 6.0. Please use the Ob
jectFactory.mapProperty() method instead.

> Task :openApiGenerators
The following generators are available:

CLIENT generators:
    - ada
    - android
    - apex
    - bash
    - c
    - clojure
    - cpp-qt5-client
    - cpp-restsdk
    - cpp-tizen
    - csharp
    - csharp-netcore
    - dart
    - dart-jaguar
    - eiffel
    - elixir
    - elm
    - erlang-client
    - erlang-proper
    - flash
    - go
    - go-experimental (experimental)
    - groovy
    - haskell-http-client
    - java
    - javascript
    - javascript-closure-angular
    - javascript-flowtyped
    - jaxrs-cxf-client
    - jmeter
    - kotlin
    - lua
    - nim (beta)
    - objc
    - ocaml
    - perl
    - php
    - powershell
    - python
    - python-experimental (experimental)
    - r
    - ruby
    - rust
    - scala-akka
    - scala-gatling
    - scalaz
    - swift4
    - typescript-angular
    - typescript-angularjs
    - typescript-aurelia
    - typescript-axios
    - typescript-fetch
    - typescript-inversify
    - typescript-jquery
    - typescript-node
    - typescript-rxjs


SERVER generators:
    - ada-server
    - aspnetcore
    - cpp-pistache-server
    - cpp-qt5-qhttpengine-server
    - cpp-restbed-server
    - csharp-nancyfx
    - erlang-server
    - fsharp-functions (beta)
    - fsharp-giraffe-server (beta)
    - go-gin-server
    - go-server
    - graphql-nodejs-express-server
    - haskell
    - java-inflector
    - java-msf4j
    - java-pkmst
    - java-play-framework
    - java-undertow-server
    - java-vertx
    - jaxrs-cxf
    - jaxrs-cxf-cdi
    - jaxrs-cxf-extended
    - jaxrs-jersey
    - jaxrs-resteasy
    - jaxrs-resteasy-eap
    - jaxrs-spec
    - kotlin-server
    - kotlin-spring
    - kotlin-vertx (beta)
    - nodejs-express-server (beta)
    - php-laravel
    - php-lumen
    - php-silex
    - php-slim
    - php-symfony
    - php-ze-ph
    - python-aiohttp
    - python-blueplanet
    - python-flask
    - ruby-on-rails
    - ruby-sinatra
    - rust-server
    - scala-finch
    - scala-lagom-server
    - scala-play-server
    - scalatra
    - spring


DOCUMENTATION generators:
    - asciidoc
    - cwiki
    - dynamic-html
    - html
    - html2
    - openapi
    - openapi-yaml


SCHEMA generators:
    - avro-schema (beta)
    - mysql-schema


CONFIG generators:
    - apache2
    - graphql-schema
    - protobuf-schema (beta)


OTHER generators:





BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed

第一次尝试这个,不知道哪里出了问题。

最终我想让它工作,然后指定模板,以便我可以添加 lombok 注释(正如这个问题 中所问但尚未回答)。但是,我必须先让代码生成工作。

我调用了错误的方法。 openApiGenerators 只是列出了它正在做的生成器。要生成输出,您必须调用在 openApiGenerate 上面创建的任务。感谢@philonous 的回答。