Reputation: 11106
What's the difference between spring-boot:run
and spring-boot:start
?
I see both them being available as Maven goals.
But what's the difference?
Upvotes: 25
Views: 12891
Reputation: 3623
To understand the difference, compare mvn clean spring-boot:run
with mvn clean spring-boot:start
In the first case Spring Boot Maven Plugin will execute all required Maven goals and then start your application.
mvn clean spring-boot:run
[INFO] --- clean:3.4.0:clean (default-clean)
[INFO] --- resources:3.3.1:resources (default-resources)
[INFO] --- compiler:3.13.0:compile (default-compile)
[INFO] --- resources:3.3.1:testResources (default-testResources)
[INFO] --- compiler:3.13.0:testCompile (default-testCompile)
[INFO] --- spring-boot:3.4.2:run (default-cli)
In the second case you'll end up with
Unable to find a suitable main class, please add a 'mainClass' property
because the compile
phase has not been executed.
After mvn compile
it will work and launch your app in background - not blocking the console, so to stop it you will need to explicitly run
mvn spring-boot:stop
intstead of Ctl+C
Upvotes: 0
Reputation: 10652
From the documentation:
spring-boot:run runs your Spring Boot application.
spring-boot:start [..] Start a spring application. Contrary to the run goal, this does not block and allows other goal to operate on the application. This goal is typically used in integration test scenario where the application is started before a test suite and stopped after.
Upvotes: 8
Reputation: 48258
spring-boot:run
Description:
Run an executable archive application.
spring-boot:start
Description:
Start a spring application. Contrary to the run goal, this does not block and allows other goal to operate on the application. This goal is typically used in integration test scenario where the application is started before a test suite and stopped after.
the info is right here:
http://docs.spring.io/spring-boot/docs/current/maven-plugin/index.html
Upvotes: 18