I have a conventions plugin (a precompiled script plugin) which;
- includes the openapi generator gradle plugin
- registers a custom task using the
org.openapitools.generator.gradle.plugin.tasks.GenerateTask
that the openapi generator plugin provides.
It looks something like:
plugins {
id 'org.openapi.generator'
}
...
task openApiGenerateClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){
generatorName = "java" // https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/java.md
inputSpec = "$projectDir/openapi.json"
outputDir = "$buildDir/generated/client"
invokerPackage = "${rootProject.group}.openapi.client"
apiPackage = invokerPackage
modelPackage = invokerPackage
configOptions = [
"dateLibrary": "java8",
"library": "resttemplate",
]
}
however I get an error saying ‘org’ is an unknown property when I attempt to build;
> groovy.lang.MissingPropertyException: Could not get unknown property 'org' for project ':openapi' of type org.gradle.api.Project.
Any ideas?
I am able to provide a custom task from my project’s build.gradle (outside of the precompiled script plugin – but I really need to register the custom task inside the conventions plugin).
My precompiled script’s build.gradle looks something like:
plugins {
id 'maven-publish'
}
group = 'com.foo.conventions'
repositories {
gradlePluginPortal()
}
dependencies {
implementation 'org.openapi.generator:org.openapi.generator.gradle.plugin:5.3.0' // https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin
...
}