0

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

Kuba
  • 854
  • 1
  • 8
  • 19
  • The `grails.agent.reload` question you point to is addressing Grails 3, when Spring Loaded was configured in the project by default. The question here is addressing Grails 4/5, versions for which that is not the case. – Jeff Scott Brown Jan 14 '22 at 14:28

1 Answers1

0

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

Jeff Scott Brown
  • 26,804
  • 2
  • 30
  • 47
  • hey @jeff-scott-brown I did removed it but this print statement is stil being reached https://github.com/grails/grails-core/blob/464a532d37fd81ccd8ec79a1f76a9657bfed5992/grails-core/src/main/groovy/grails/boot/GrailsApp.groovy#L386 – Kuba Jan 14 '22 at 16:34
  • Do you have a reloading agent configured in the project? – Jeff Scott Brown Jan 14 '22 at 17:12