I am using IntelliJ 13.1 on Linux and try to build a basic REST application following the example http://spring.io/guides/gs/spring-boot/
When I execute the target bootRun from within IntelliJ the intergrated tomcat server is started and everything works fine.
10:09:35: Executing external task 'bootRun'... :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :findMainClass :bootRun
But stopping the execution does not affect the gradle task:
10:11:40: External task execution finished 'bootRun'.
I still can access the tomcat instance on the configured port. Only closing IntelliJ will destroy the process.
I searched on this topic but could not find any reasonable answers. I wonder if it is a
You can use the command gradle -stop to stop the Spring Boot application.
IntelliJ interacts with Gradle via the Gradle tooling API, which always uses the daemon. i.e. There is no way to turn it off. "gradle idea" is needed only to generate the required files. Though the recent versions of Idea use "directory-based" project structure, so the file generation is no longer necessary.
Use the static exit() method in the SpringApplication class for closing your spring boot application gracefully.
In the Project tool window, double click the build. gradle file to open it in the editor. in the editor to load the changes to your project. In the Gradle tool window, open the project's node, then the Tasks node and double-click the build task to run it.
I am pretty sure it's an IntelliJ issue because:
When you run the bootRun
from IntelliJ's Gradle integration and then press stop, the application continues to run as you mentioned.
However, if you use the command line and run gradle bootRun
and then use Cntrl+C, the application stops just fine.
Note that my setup is Windows 7, IntelliJ 13.1.3, Gradle 1.12 and Spring Boot 1.1.0.M2.
If your need to is to be able to easily debug your application, all you need to do is run the Java (or Groovy) Class that has the main
method, since that it is the easiest way to run Spring Boot applications! Kudos to Spring Boot for that!!!
Of course you can continue to use Gradle for tasks like running all the tests or creating the packaged application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With