Spring Boot bootRun blocking the CI job (never exits) in CI
bootRun and spring-boot:run start the application and block until it is stopped. In CI that means the step runs until the job times out, because nothing tells the server to exit.
What this error means
A CI step using ./gradlew bootRun or mvn spring-boot:run prints "Started Application in N seconds" and then hangs until the job hits its timeout and is canceled.
Started ExampleApplication in 6.2 seconds (process running for 6.9)
<<< bootRun keeps running, holding the step open >>>
Error: The operation was canceled.Common causes
bootRun is a foreground server, not a check
It is meant for local development; it stays up serving requests and never returns control to the CI step.
Used to "verify startup" without a stop condition
A job runs bootRun to see if the app boots, but provides no way to shut it down, so the step never completes.
How to fix it
Verify startup with a test, not bootRun
Assert the context loads with a lightweight test that starts and stops cleanly.
@SpringBootTest
class ApplicationSmokeTest {
@Test void contextLoads() {}
}If you must run it, background it and stop it
Start the server in the background, probe a health endpoint, then kill it.
./gradlew bootRun &
PID=$!
timeout 60 bash -c 'until curl -sf localhost:8080/actuator/health; do sleep 2; done'
kill $PIDHow to prevent it
- Use
contextLoadstests to verify the app boots in CI. - Never run a foreground server as a blocking CI step without a stop.
- If a running app is required, background it, health-check, then terminate.