Skip to content

fix: Register assemble dependency for forkenSpringBootRun task #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const val EXTENSION_NAME = "openApi"
const val GROUP_NAME = "OpenApi"
const val OPEN_API_TASK_NAME = "generateOpenApiDocs"
const val OPEN_API_TASK_DESCRIPTION = "Generates the spring doc openapi file"

const val JAVA_ASSEMBLE_TASK_NAME = "assemble"
const val SPRING_BOOT_RUN_TASK_NAME = "bootRun"
const val SPRING_BOOT_RUN_MAIN_CLASS_NAME_TASK_NAME = "bootRunMainClassName"
const val SPRING_BOOT_3_RUN_MAIN_CLASS_NAME_TASK_NAME = "bootRun"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ open class OpenApiGradlePlugin : Plugin<Project> {
plugins.apply(EXEC_FORK_PLUGIN)

extensions.create(EXTENSION_NAME, OpenApiExtension::class.java)
tasks.register(FORKED_SPRING_BOOT_RUN_TASK_NAME, JavaExecFork::class.java)
tasks.register(FORKED_SPRING_BOOT_RUN_TASK_NAME, JavaExecFork::class.java) { task ->
task.dependsOn(JAVA_ASSEMBLE_TASK_NAME)
}
tasks.register(OPEN_API_TASK_NAME, OpenApiGeneratorTask::class.java)

generate(this)
Expand Down Expand Up @@ -55,6 +57,7 @@ open class OpenApiGradlePlugin : Plugin<Project> {
FORKED_SPRING_BOOT_RUN_TASK_NAME,
JavaExecFork::class.java
) { fork ->
fork.dependsOn(tasks.named(JAVA_ASSEMBLE_TASK_NAME))
fork.dependsOn(tasks.named(bootRunMainClassNameTask.name))
fork.onlyIf { needToFork(bootRunTask, customBootRun, fork) }
}
Expand Down