繁体   English   中英

调试在 Intellij 的自定义任务中启动的 Spring 引导应用程序

[英]Debug a Spring Boot application started in custom task in Intellij

我使用 Spring Boot 并希望每次在bootRun之前执行 Spotless 以重新格式化代码,所以我在我的 build.gradle.kts 中编写了以下任务:

task("startServer") {
    setGroup("Sample category")
    dependsOn(":security:spotlessApply", ":database:spotlessApply").finalizedBy(":convo:bootRun")
}

当我在调试模式下执行这个任务时,Intellij 不会在断点处停止,但是如果我执行内置的bootRun任务,它就可以工作。

如何让 Intellij 调试在我的startServer任务中启动的 Spring 引导应用程序?

我找到了一种方法来实现这一点,而不是编写自定义任务,而是直接在应用程序(这里是我的 convo 模块) build.gradle.ktsbootRun任务中添加dependsOn

tasks.withType<org.springframework.boot.gradle.tasks.run.BootRun>() {
    dependsOn(":database:spotlessApply").dependsOn(":security:spotlessApply")
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM