Proposal: Move OpenAPI Generated Java Sources to Gradle-Compliant Directory #1081
Replies: 6 comments 6 replies
-
|
Sounds reasonable to me. |
Beta Was this translation helpful? Give feedback.
-
|
FYI: this is the gradle task i added to workaround this issue: tasks.register('relocateAllOpenApiSources') {
dependsOn 'quarkusGenerateCode','quarkusGenerateCodeTests', 'quarkusGenerateCodeDev', 'generateEffectiveLombokConfig'
doLast {
// Move main-generated sources
copy {
from 'build/classes/java/quarkus-generated-sources/open-api'
into 'build/generated/sources/openapi/java'
include '**/*.java'
}
// Move test-generated sources
copy {
from 'build/classes/java/quarkus-test-generated-sources/open-api'
into 'build/generated/sources/openapiTest/java'
include '**/*.java'
}
delete fileTree('build/classes/java/quarkus-test-generated-sources/open-api') {
include '**/*.java'
}
delete fileTree('build/classes/java/quarkus-generated-sources/open-api') {
include '**/*.java'
}
}
}
// Ensure compileJava depends on the relocation
compileJava {
dependsOn tasks.relocateAllOpenApiSources
}
|
Beta Was this translation helpful? Give feedback.
-
|
@qa-alexander-schreiner this path is handled by Quarkus under the hood, IIRC. I'd rather not change it so we won't break compatibility with our parent framework. Can also potentially break devmode: https://stackoverflow.com/questions/66199052/setting-target-directory-for-grpc-classes-generated-by-quarkus-gradle-plugin The grpc extension is our cousin, so that reply also applies to us. |
Beta Was this translation helpful? Give feedback.
-
|
One more thing: I think this is a relevant discussion, though. You can open a thread on Quarkus Zulip message board about the code generation extensions and Quarkus. I bet they already solved this problem. @gastaldi do you know who can we contact about this? @qa-alexander-schreiner by the way, I'm assuming you're using Quarkus Gradle? https://quarkus.io/guides/gradle-tooling |
Beta Was this translation helpful? Give feedback.
-
|
The problem is just that i have lombok annotations on the generated java code. The workaround that i've commented here earlier is also not very stable, unfortunately. Also thank you already for your asistence, really appreciate your effort :) |
Beta Was this translation helpful? Give feedback.
-
|
This was mentioned in the description but I think an example of this breaking build tooling expectations is |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal: Move OpenAPI Generated Java Sources to Gradle-Compliant Directory
Context
Currently, the Quarkus OpenAPI Generator outputs generated Java source files to:
build/classes/is conventionally reserved for compiled.classfiles. Placing.javasource files here can lead to significant issues during test execution and build tooling interactions.Problem
Misplacing generated
.javasources in a compiled-output directory causes:.builder()methods not generated)NoSuchMethodErrorat runtime due to missing constructors or builder-methodsProposal
Change the output path for generated Java source files to:
Beta Was this translation helpful? Give feedback.
All reactions