【发布时间】:2017-10-11 22:13:21
【问题描述】:
我正在尝试跟随 this example 进行 spring boot 和 spring boot dev tools 集成以进行自动重启。当我运行build --continuous 任务时,构建文件夹中的类正在更新,但应用程序仍然与旧类对话。在示例中,bootRun 任务如下所示。我的项目有运行应用程序的自定义任务。现在使用build -continuous,当我对应用程序进行更改时,它正在重建类,但正在运行的应用程序没有显示更改。如何更改我的自定义 h2Run 任务以加载更改后的类?谢谢。
示例中的开机运行任务
bootRun {
classpath = sourceSets.main.runtimeClasspath + configurations.dev
}
我的 bootRun 自定义任务
class Run extends JavaExec {
Run() {
group "application"
dependsOn project.tasks.classes, project.tasks.pathingJar
classpath = project.files("$project.buildDir/classes/main", "$project.buildDir/resources/main", project.tasks.pathingJar.archivePath)
main = "com.mycompany.Application"
}
}
task h2Run(type: Run) {
classpath = sourceSets.main.runtimeClasspath + configurations.dev // this is not working
description "Start $appName using H2 database"
args "--spring.profiles.active=dev"
mustRunAfter 'cleanH2'
dependsOn copyContentTypeLibraries
}
【问题讨论】:
-
如果没有人可以回答,请投票。我需要恢复我的声誉。 ;)
标签: spring spring-boot gradle spring-boot-devtools