Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grails 6.1.2: migrating away from grails run-app affects hotreloading of grails plugin in a gradle multi-module project #13405

Open
reluctant-lee opened this issue Feb 28, 2024 · 3 comments

Comments

@reluctant-lee
Copy link

Issue description

Previous Behaviour: Grails 5

On grails 5, the grails run-app command allowed us to successfully hotreload a multi-project structure like this:

folder/
--main app (grails 5 app)
------grails-app
------build.gradle
------settings.gradle
--dev utils (grails 5 app plugin)
------grails-app
------build.gradle
------settings.gradle

The main app's build.gradle file would conditionally include the plugin based on development environment.

Developers could add their own dev and testing utils that could be successfully live reloaded with a custom hotswap agent or spring dev tools.

Issue: broken hotreloading migrating away from run-app

With Grails 6+, we are trying to move away from grails run-app as suggested and use the gradlew wrapper instead.

However, hotreloading of the plugin does not work with either custom hotswap agent or spring dev tools using the gradle wrapper or gradle directly.

Reimplement or gradle alternative?

Hot reloading was a handy side effect of whatever grails run-app was doing. Like to have that back.

Would it be worth reimplementing a stripped down version of run-app? If so where is the original src for that? Haven't found the right file in the repo yet.

Or can we achieve the same thing with gradle build scripts and project restructuring? (I would post what I've tried, but it is be a lot of variations with no luck and would be a boring read.)

@reluctant-lee
Copy link
Author

I can work around it with gradle somewhat. By using the --continuous flag on certain gradle tasks, I can get it to reload controllers of the plugin, but not plugin views in their entirety..

Hotswap agent is able to detect changes to the gsp classes, but it does not reload the corresponding html data file,

HOTSWAP AGENT: 15:33:55.007 RELOAD (org.hotswap.agent.config.PluginManager) - Reloading classes [gsp_dev_devindex_gsp]

Not reloaded: gsp_dev_devindex_gsp_html.data

@osscontributor
Copy link
Member

On grails 5, the grails run-app command allowed us to successfully hotreload a multi-project structure

Are you using JRebel or Spring Loaded?

@bruno-lopes
Copy link

@reluctant-lee I'm trying to use HotSwap Agent, and I followed this: https://stackoverflow.com/a/71264467

Except that I'm using IntelliJ debug, so I set autoHotswap=false in hotswatp-agent.properties. Changes are detected by HotSwap Agent:

File /home/bruno/git/application/plugin/grails-app/controllers/br/test/plugin/TestController.groovy changed, recompiling...

But then I get an error:

HOTSWAP AGENT: 16:36:58.401 INFO (org.hotswap.agent.plugin.spring.scanner.XmlBeanRefreshCommand) - Executing XmlBeanDefinitionScannerAgent.reloadXml('file:/home/bruno/git/application/plugin/build/classes/groovy/main/META-INF/grails-plugin.xml')
HOTSWAP AGENT: 16:36:58.402 ERROR (org.hotswap.agent.plugin.spring.scanner.XmlBeanDefinitionScannerAgent) - failed to convert filePath /home/bruno/git/application/plugin/build/classes/groovy/main/META-INF/grails-plugin.xml to classPath path

And the changes are not really reloaded.

I'm using groovyReset.jar from here: https://github.com/jenkinsci/squashtm-publisher-plugin/tree/master/groovy-hotswap

Any ideas?

Thanks.

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

No branches or pull requests

3 participants