Grails 4 Spring Boot Dev Tools

Answered

Hello,

I'm using IntelliJ to develop Grails Projects. I've made an upgrade to Grails 4, which includes the Spring Boot Dev Tools. Unfortunately there is always an app reload if I make some changes at my GSPs although I made the correct (I guess) config settings in application.yml.

spring:
main:
banner-mode: "off"
groovy:
template:
check-template-location: false


jmx:
unique-names: true

devtools:
restart:
additional-exclude:
- '*.gsp'
- '*.gson'
- 'logback.groovy'
- '*.properties'
exclude:
- grails-app/views/**
- grails-app/i18n/**
- grails-app/conf/**

Are there any ideas why?

Thanks!

0
13 comments

What IDE version do you use? What Run/Debug Configuration do you use? Do you launch it in Debug mode? Do you have Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Runner | Delegate IDE build/run actions to gradle enabled?

A sample project would be very helpful to investigate the problem.

0
Avatar
Permanently deleted user

Hello Andrey,

thank you for your answer.

The IDE-Version is IntelliJ IDEA 2018.3.5 / Build #IU-183.5912.21, built on February 26, 2019.

The app is not running in debug mode.

Delegate IDE build/run actions to gradle is enabled.

It's a bit strange becuase the app is always restarting after every save/autosave.

0

What Run/Debug Configuration do you use?

Have you tried to launch it it Debug mode?

0
Avatar
Permanently deleted user

Do you mean this?

0
Avatar
Permanently deleted user

And, I forgot, it's the same in debug mode.

0

As documentation specifies in Spring Boot Developer Tools and Spring Loaded section, the configuration must be like:

spring:
    devtools:
        restart:
            exclude:
                - grails-app/views/**
                - grails-app/i18n/**
                - grails-app/conf/**

I do not see  additional-exclude anywhere mentioned. Have you tried to specify all in exclude section?

If you see issue remains, please provide a sample project, describe the steps to reproduce. Thanks.

0
Avatar
Permanently deleted user

Thank you. The spring doc says: "If you want to keep those defaults and add additional exclusions, use the spring.devtools.restart.additional-exclude property instead."

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html#using-boot-devtools-restart-exclude

But I have also a sample project without the additional-exclude property set.

How can I provide the project?

0

For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.

Please describe also the exacts steps and the expected/actual result. In my sample project it works fine: the app is not restarted if I just change the .gsp file and invoke build action from IDE.

0
Avatar
Permanently deleted user

Okay, my steps:

When the app is running, I change the <h1>subline</h1> to <h1>subline1</h1> or something else at the index.gsp in views/server.

After pressing Ctrl-S the app restarts.

 

The upload is done:

Uploading...
File uploaded: GPlayground.zip
Upload complete!
0

With configuration like 

restart:
exclude:
- grails-app/views/**
- grails-app/i18n/**
- grails-app/conf/**
additional-exclude:
- '*.gsp'
- '*.gson'
- 'logback.groovy'
- '*.properties'

I do not get restarts if I edit files under grails-app/views/ directory and getting restarts if edit under e.g. grails-app/views/server directory. The same behaviour is when I'm running grails from command line. It does not seems to be related to IntelliJ IDEA.

0
Avatar
Permanently deleted user

That is totally weird. I don't know what I can do now. Strange, strange!

Thank you very much for your help!

0
Avatar
Permanently deleted user

Hey Andrey,

just want to let you know: there is also a discussion at grails.slack.com. The fixing (for the moment) is:

additional-exclude:
- '**/*.gsp'

That works for me.

0

Thanks for the information!

0

Please sign in to leave a comment.