Hi, there,
I am rather new to gradle and hit an issue I cannot work around. Appreciate any pointer.
Context: I am using openApiGenerator plugin to codegen java from swagger spec. What I want to do is to: 1) codegen java 2) build my own codes (which depend on the autogen java codes).
My approach so far: Here’s my folder structure
------ root
|--------openApi
| ------- src
|---------main/java/…
|-------- test/java/…
build.gradle
In my root folder’s build.gradle, I have:
openApiGenerate task to output the codegen java files under openApi
declare dependency of: implementation project(":root:openApi")
tasks.openApiGenerate.finalizedBy ":root:openApi:compileJava"
I intend following things to happen in sequence:
- openApiGenerate to codegen, and create build.gradle under openApi folder
- run compileJava task under openApi folder
- run compileJava task under root folder.
However, it fails at step 2. Looking into the info log, it appears :root:openApi: project configuration happened before openApiGenerate. That makes sense to me because configuration happens before execution. Which begs the questions:
- is there a way to let openApiGenerate run BEFORE :root:openApi project configuration? I don’t think it’s possible after reading gradle project life cycle doc. But correct me if I am wrong.
- is there a way to force :root:openApi project to reload its configuration after openApiGenerate? maybe via a customized task?
Thank you in advance!