6

With my Gradle build I want to start my Spring Boot application, run some tests and then shutdown the Spring boot application. First I try just to start the server and then shutdown, leaving out the tests for now.

Part of my build.gradle file looks like this

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
}

I start the build from the command line like this

gradle integrationTest -Dendpoints.shutdown.enabled=true

The build starts the Spring Boot application but it is not proceeding (of course) to the shutdown task. I can run the shutdown task separately and it will take down the Spring Boot app.

But, how can I get the server to run and shutdown in the same build?

1 Answer 1

1

I'm not sure it will work with a task like bootRun, but I think you're looking for something like a ParallelizableTask

Also you would have to pass the --parallel command line option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.