Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ does not terminate Spring Boot applications build with gradle

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

  • gradle problem (using gradle wrapper version 1.11)
  • Linux problem (Ubuntu 12.04)
  • IntelliJ problem (IDEA 13.1.2)
  • Spring Boot problem (tried different versions from 1.0.0.RELEASE to 1.1.0.M2)
like image 718
Christian Metzler Avatar asked Jun 03 '14 08:06

Christian Metzler


People also ask

How do I stop Spring Boot gradle?

You can use the command gradle -stop to stop the Spring Boot application.

How do I stop gradle daemon in IntelliJ?

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.

How do I stop Spring Boot applications?

Use the static exit() method in the SpringApplication class for closing your spring boot application gracefully.

How do I run a Spring Boot gradle application in IntelliJ?

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.


1 Answers

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.

like image 97
geoand Avatar answered Sep 23 '22 12:09

geoand