2016-11-29 13 views
2

使用我的Gradle構建我想啓動我的Spring Boot應用程序,運行一些測試,然後關閉Spring引導應用程序。首先,我嘗試啓動服務器,然後關機,現在就放棄測試。我的build.gradle文件在Gradle構建中,啓動Spring引導應用程序,運行測試,然後停止Spring引導應用程序

部分看起來像這樣

bootRun { 
    systemProperties = System.properties 
} 

task shutdown(type: org._10ne.gradle.rest.RestTask) { 
    httpMethod = 'post' 
    uri = 'http://localhost:8080/shutdown' 
} 

task integrationTest() { 
    dependsOn bootRun 
    finalizedBy shutdown 
} 

我這樣從

gradle integrationTest -Dendpoints.shutdown.enabled=true 

構建命令行啓動構建啓動春季啓動應用程序,但它沒有繼續(當然)關閉任務。我可以單獨運行關閉任務,它將取消Spring Boot應用程序。

但是,如何讓服務器在同一個版本中運行和關閉?

回答

1

我不知道它會與像​​任務的工作,但我認爲你正在尋找的東西像ParallelizableTask

你也必須通過--parallel命令行選項。

相關問題