Java Grails 2.3.0 自动重新加载不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18882589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Grails 2.3.0 Auto-reloading not working
提问by Emmanuel John
I recently upgrade our project to grails 2.3.0. Everything works fine except I've been having problems with auto-reload not working whenever I make changes to our code. This include all projects artefacts - controllers, domain, services, gsps, css and javascript files.
我最近将我们的项目升级到 grails 2.3.0。一切正常,除非我在更改代码时遇到自动重新加载无法正常工作的问题。这包括所有项目人工制品 - 控制器、域、服务、gsps、css 和 javascript 文件。
My older versions of grails work correctly and reloads and recompile every time I make a change.
我的旧版本 grails 可以正常工作,并且每次进行更改时都会重新加载和重新编译。
I know this question is popular and I have searched Jira, Nabble and here for days now but none of what I have found have been able to solve my problem (I've even tried to add quotes like Peter suggested in this thread http://jira.grails.org/browse/GRAILS-7936and also this thread Grails Project Not Auto Reloadingdid not help).
我知道这个问题很受欢迎,我已经搜索了 Jira、Nabble 和这里好几天了,但我发现的所有内容都无法解决我的问题(我什至尝试添加像 Peter 在此线程中建议的引号http:/ /jira.grails.org/browse/GRAILS-7936以及此线程Grails Project Not Auto Reloading没有帮助)。
Am currently running grails on a Macbook pro with the following settings:
我目前在 Macbook pro 上使用以下设置运行 grails:
- grails version 2.3.0
- Java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
- Running from terminal with Textmate as IDE
- 圣杯版本 2.3.0
- Java 版本“1.7.0_17” Java(TM) SE 运行时环境(构建 1.7.0_17-b02)Java HotSpot(TM) 64 位服务器 VM(构建 23.7-b01,混合模式)
- 使用 Textmate 作为 IDE 从终端运行
Any help would be greatly appreciated.
任何帮助将不胜感激。
采纳答案by Alidad
It seems that in Grails 2.3 the reloading is no longer the default
似乎在 Grails 2.3 中,重新加载不再是默认设置
In Grails 2.3 the reloading agent is no longer on the build system path unless you pass the -reloading flag to the grails command:
grails -reloading run-app
在 Grails 2.3 中,除非您将 -reloading 标志传递给 grails 命令,否则重新加载代理不再位于构建系统路径上:
grails -reloading run-app
However, you can enable forking in your buildConfig using the following configuration:
但是,您可以使用以下配置在 buildConfig 中启用分叉:
forkConfig = [maxMemory: 1024, minMemory: 64, debug: false, maxPerm: 256]
grails.project.fork = [
test: forkConfig, // configure settings for the test-app JVM
run: forkConfig, // configure settings for the run-app JVM
war: forkConfig, // configure settings for the run-war JVM
console: forkConfig // configure settings for the Swing console JVM ]
More information : Forked Execution and the Reloading Agent
更多信息:分叉执行和重新加载代理
回答by Marcello de Sales
Grails 2.4.x maintained the same support:
Grails 2.4.x 保持相同的支持:
grails -reloading run-app
The logs will show the status of the reload once a "watched" file changes in the file-system:
一旦文件系统中的“监视”文件发生更改,日志将显示重新加载的状态:
2014-09-23 00:42:02,666 [localhost-startStop-1] INFO conf.BootStrap - Checking for registries in system env
| Server running. Browse to http://localhost:8080/docker-registry-ui
| Compiling 1 source files.....
回答by Tim
I am using Grails 2.4.3 and IntelliJ 13 and I found that I had to have the -reloading
part at the end of the run-app
command.
我正在使用 Grails 2.4.3 和 IntelliJ 13,我发现我必须-reloading
在run-app
命令的末尾有这个部分。
In other words when you edit your Run/Debug configurations, in the 'Command Line' part put run-app -reloading
and NOT -reloading run-app
.
换句话说,当您编辑运行/调试配置时,在“命令行”部分 putrun-app -reloading
和 NOT -reloading run-app
。
I found this solution herefrom user longwa
我在这里从用户 longwa找到了这个解决方案
回答by Samuel Ivan
I dont need run with -reloading in the command line, its problem of springloaded.jar.
我不需要在命令行中使用 -reloading 运行,它的 springloaded.jar 问题。
replace folder springloaded in grailsHome/lib/org.springframework/springloaded with the of grails sdk 2.4.3
用 grails sdk 2.4.3 替换 grailsHome/lib/org.springframework/springloaded 中的文件夹 springloaded
https://mega.co.nz/#F!INgVnboD!r7ssrFy9TiCQ50ROqxWt8g
https://mega.co.nz/#F!INgVnboD!r7ssrFy9TiCQ50ROqxWt8g
I tested in grails 2.5.0 and 2.4.*
我在 grails 2.5.0 和 2.4.* 中进行了测试
回答by abdielou
I was not able to fix my problem with reloading by any of the suggestions above. In my case the problem was my path, it contained a space! Took me a couple of days and half my beard but finally figured it out.
My path was something like : ~/Box Sync/path/to/project
.
That single space in Box Sync
was the hidden bad guy.
I beleive it to be related to this ticket https://github.com/grails/grails-core/issues/9344.
我无法通过上述任何建议解决重新加载的问题。在我的情况下,问题是我的路径,它包含一个空格!我花了几天时间和一半的胡须,但终于弄明白了。我的路径是这样的:~/Box Sync/path/to/project
。里面的那个空间Box Sync
是隐藏的坏人。我相信它与这张票https://github.com/grails/grails-core/issues/9344 有关。