Skip to content

Hot reload for Grails 4 & JDK 8#11441

Merged
graemerocher merged 4 commits into4.0.xfrom
eric/springLoadedGrails4
Dec 4, 2019
Merged

Hot reload for Grails 4 & JDK 8#11441
graemerocher merged 4 commits into4.0.xfrom
eric/springLoadedGrails4

Conversation

@erichelgeson
Copy link
Copy Markdown
Contributor

Add back in the option for hot reloading from spring-loaded. Though spring-loaded is all but abandoned - it does work well for Java 8. For hot reloading on JDK 8/11+ JRebel works as well.

This is needed as large projects can not tolerate upgrades due to how long dev-tools restarts take (sometimes up to 3 minutes per change). With spring loaded & a native file watcher on osx/linux this is sub second. Users can choose which option - dev-tools is still the default.

To enable:

build.gradle

dependencies {
    // Remove dev-tools from classpath
    // developmentOnly("org.springframework.boot:spring-boot-devtools") 
    agent "org.springframework:springloaded:1.2.8.RELEASE"
    // (Optional) Native OSX file watcher
    runtimeOnly "io.methvin:directory-watcher:0.9.6"
    //...
}

@erichelgeson erichelgeson added this to the grails-4.0.2 milestone Nov 27, 2019
@jameskleeh
Copy link
Copy Markdown
Contributor

Are you planning on a CLI change to go along with this?

@erichelgeson
Copy link
Copy Markdown
Contributor Author

eg: create-app --features=springloaded - potentially - will be documented after merge as well.

@davydotcom
Copy link
Copy Markdown
Contributor

+1 to this

@bobbywarner
Copy link
Copy Markdown
Contributor

I tested this locally and it works great. Reloading of Grails controllers, Grails services as well as regular Groovy classes all worked successfully.

@graemerocher graemerocher merged commit cd750f7 into 4.0.x Dec 4, 2019
@erichelgeson erichelgeson deleted the eric/springLoadedGrails4 branch February 4, 2020 14:49
@demon101
Copy link
Copy Markdown
Contributor

demon101 commented Apr 12, 2020

@erichelgeson with agent "org.springframework:springloaded:1.2.8.RELEASE" hot reload working well, but grails war fails with error

Could not find method agent() for arguments [org.springframework:springloaded:1.2.8.RELEASE] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

gradle asseble works without errors.

Should I create an issue or gradle asseble can be used instead of grails war?

@matthijsbierman
Copy link
Copy Markdown
Contributor

@demon101 I think this can be fixed by adding the agent to configurations:

configurations {
    agent
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

@demon101
Copy link
Copy Markdown
Contributor

demon101 commented May 5, 2020

@matth

I think this can be fixed by adding the agent to configurations:

works! Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants