Search code examples
grails

Disabling dynamicReload/developmentModeWatch in Grails4/5 for DEV Environemnt


I would like to disable the dynamic reload mechanism in Grails4/5.

In my case it's not effective enough so I rather avoid all the "File {} changed, recompiling..." messages

I'm very well aware of suggestions like this to put grails.agent.enabled = false in build.gradle

but this seems not to work.

I found in the source code this if condition:

        if(environment.isReloadEnabled()) {
            log.debug("Reloading status: {}", environment.isReloadEnabled())
            enableDevelopmentModeWatch(environment, applicationContext)
            environment.isDevtoolsRestart()
        }

with getting the value here:

    public boolean isReloadEnabled() {
        final boolean reloadOverride = Boolean.getBoolean(RELOAD_ENABLED);
        getReloadLocation();
        final boolean reloadLocationSpecified = hasLocation(reloadLocation);
        return this == DEVELOPMENT && reloadLocationSpecified ||
                reloadOverride && reloadLocationSpecified;
    }

but this pretty much always evaluates to true.

The reloadLocation will always be something where reloadOverride will be always null


Solution

  • You can remove org.springframework.boot:spring-boot-devtools from your dependencies.