mvn spring-boot:run: Usage & Common CI Errors
Run a Spring Boot app straight from Maven - no packaged jar needed.
spring-boot:run is a goal of the spring-boot-maven-plugin that compiles and runs your application directly from the source tree, without first building a jar. It is handy for local dev and for integration-test or smoke-test steps in CI.
What it does
spring-boot:run launches the application’s main class in a forked JVM with the project classpath. JVM args, program args, and the active profile are passed via plugin properties so you can run the same app in different environments.
Common usage
mvn spring-boot:run
mvn spring-boot:run -Dspring-boot.run.profiles=test
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=0
mvn spring-boot:run -Dspring-boot.run.jvmArguments=-Xmx512mCommon error in CI (and the fix)
Symptom: "Web server failed to start. Port 8080 was already in use" when a CI step starts the app for smoke tests. Cause: a previous run or another service holds the port. Fix: bind to an ephemeral port with -Dspring-boot.run.arguments=--server.port=0 (or set a free port explicitly), and ensure prior app processes are stopped before the next step starts.