openapi-generator gradle plugin output directory

Viewed 1610

I am using the openapi-generator Gradle plugin to generate model files from the open API schema. With these settings in build.gradle script everything seems ok:

openApiGenerate {
globalProperties = [
        apis: "false",
        modelDocs: "false",
        models: "Pet"
]
generatorName = "java"
generateModelTests = false
inputSpec = "$rootDir/src/main/resources/schema/my_schema.json".toString()
outputDir = "$rootDir".toString()
modelPackage = "org.openapi.example.model"
configOptions = [
        dateLibrary: "java8",
        serializationLibrary: "jackson",
        library: "jersey1"
]

}

And the result classes are generated in the proper package:

enter image description here

The problem is here - I don't need them in my sources, I need them only at compile stage. I want them to be generated in the build directory, to separate them from other logic. But when I am changing the output-dir to "$buildDir/generated".toString() this happens:

enter image description here

Is there a way to get rid of the wrong packages "src.main.java"?

1 Answers
Related