Giter VIP home page Giter VIP logo

Comments (12)

YudhistiraArya avatar YudhistiraArya commented on March 28, 2024

I've just found Running applications section in https://github.com/SpringSource/spring-boot/tree/master/spring-boot-tools/spring-boot-maven-plugin. Does the gradle plugin has the equivalent of $ mvn spring-boot:run?

from spring-boot.

dsyer avatar dsyer commented on March 28, 2024

Yes the gradle plugin has identical features, but that's about packaging jars and executing them, not hotswapping code in an IDE. Hotswapping chages in a running app is an IDE feature as far as I know, so if it works for other apps it will work for these ones. Unless I'm missing something there is nothing we can do to help in Spring Boot itself. Do you agree?

from spring-boot.

YudhistiraArya avatar YudhistiraArya commented on March 28, 2024

Hi dsyer,

My mistake for the running from IDE issue, I agree that one is not a Spring Boot issue.

Currently, what I'm trying to achieve here is something similar with gradle jettyRun where you can reload the code that you save and compile in IDE (as long as the resulting class file is copied into the correct folder). Is there anything like that in the current version of Spring Boot's gradle plugin if I use jetty instead of tomcat? I've tried gradle run but there's no such task. Could you point me to the correct documentation if such feature exists?

Thank you.

from spring-boot.

yanhua365 avatar yanhua365 commented on March 28, 2024

I agree @YudhistiraArya ,is there some solution?

from spring-boot.

dsyer avatar dsyer commented on March 28, 2024

Grails uses spring-loaded to reload classes compiled by another process. That should be easy to set up manually (it's just a java agent jar and the docs are pretty good). We were talking about maybe making it a feature (eg command line option) of the Boot tools support, so I guess that would include gradle as well as maven.

I'm not really a gradler, so someone else will have to answer the question of how to run from source with gradle (or you can maybe figure it out by looking at the gradle plugin source code).

from spring-boot.

philwebb avatar philwebb commented on March 28, 2024

Currently the gradle plugin only supports creating executable JARs. There is no equivalent to the maven spring-boot:run goal.

I am not an IntelliJ user but with eclipse at least you only get hot-swap code support when debugging an application. Does running in debug (Alt + Shift + F9 I think) work for you?

from spring-boot.

yanhua365 avatar yanhua365 commented on March 28, 2024

As a IntelliJ user ,it works fine for me.

First add a application.properties under resources folder with content:

spring.thymeleaf.cache: false

Then,Use IntelliJ Idea debug the application.

After edit Thymeleaf template or Java, must use CTRL+F9 to make the project.

from spring-boot.

dsyer avatar dsyer commented on March 28, 2024

There is still an outstanding feature request here (for running from command line with gradle), but since it isn't relevant to the original topic of hot redeploy, I think we can close this issue and come back to the gradle plugin in another if there is demand. I don't think it is difficult to run a java main method from gradle.

from spring-boot.

fedotxxl avatar fedotxxl commented on March 28, 2024

It's not clear for me why this ticket has been closed. This ticket is about hot swap and (as I understand) it's still not implemented

from spring-boot.

dsyer avatar dsyer commented on March 28, 2024

There is already support for reloading static resources with "gradle bootRun". If you are talking about reloading classes, the answer hasn't changed - IDEs have that feature in debug mode, and there is spring-loaded for the command line (and a separate issue for that as well). So I don't see any reason to re-open this after 4 months.

from spring-boot.

DmonUnl avatar DmonUnl commented on March 28, 2024

sorry for posting here, but it seemed relevant.

I followed this link: https://dzone.com/articles/spring-boot-application-live-reload-hot-swap-with (had to alter the first step to do the same thing but with gradle i.e. add
compile("org.springframework.boot:spring-boot-devtools")
to the gradle.build (the correct one, not any random one).

then after finishing the rest of the steps from the link, added this line to application.properties:

spring.thymeleaf.cache= false (thanks yanhua365)
THEN when running the tomcat servlets, don't just run them, need to run them in debug mode

After doing all of the above, this works by: when servlets are running in intellij -make your UI code change -save it (in my case i was using notepad++ not intellij - go back to intellij (just bring the window into focus) - then go back to browser and refresh the browser

is it possible to do the hot swap/redeploy without bringing IntelliJ into focus? i.e. i would just like to run the tomcat servlets, and then minimise intelliJ and never use it again

from spring-boot.

dsyer avatar dsyer commented on March 28, 2024

@Dmon1Unlimited this issue was closed almost 4 years ago. Please ask usage questions on Stack Overflow (and read the user guide section on devtools before doing anything).

from spring-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.