Skip to content
Latchkey

gradle bootRun: Usage & Common CI Errors

Run a Spring Boot app from source - Gradle’s spring-boot:run.

bootRun is the task added by the Spring Boot Gradle plugin (org.springframework.boot) that compiles and runs your application directly from source, without first building a jar. It is the Gradle counterpart to mvn spring-boot:run.

What it does

bootRun launches the application’s main class with the runtime classpath. Program args go through --args, the active profile through SPRING_PROFILES_ACTIVE or a system property, and JVM args via the task’s jvmArgs.

Common usage

Terminal
./gradlew bootRun
./gradlew bootRun --args='--server.port=0'
./gradlew bootRun --args='--spring.profiles.active=test'

Common error in CI (and the fix)

Symptom: "Web server failed to start. Port 8080 was already in use." when bootRun starts the app in a CI smoke-test step. Cause: another process holds the port. Fix: start on an ephemeral port with --args='--server.port=0' (or a known-free port), and make sure prior app instances are terminated before the next job; for long-lived smoke tests prefer a packaged jar with a managed lifecycle.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →