如何将Grails 2.1迁移到Grails 2.3应用程序?

Sun*_*Sun 4 grails grails-plugin grails-controller grails-2.0

我正在将我的应用程序从Grails 2.1迁移到2.3.迁移后我遇到了很多错误 - 我想要一些带有Grails 2.3和Spring集成的示例应用程序.

我做了一些HelloWorld示例应用程序,这些都运行正常.但即使我在我的应用程序中应用相同的东西,甚至在它给出错误的地方.因为我的应用程序非常大(100mb)并且我使用了很多与Spring,Hibernate和许多Grails插件的集成.

我没有找到任何类似于"从Grails 2.1迁移到Grails 2.3"的代码级文档.我无法从Grails或在线找到任何示例应用程序.

Grails官方文档,所有关于提供Grails META信息.

在我的main.gsp 229行:

<g:include controller="filter" action="tree"/>

Caused by: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:include>: Unable to execute include: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: java.lang.IllegalStateException: Cannot reset buffer after response has been committed
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.createGroovyPageException(GroovyPageView.java:205)
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.handleException(GroovyPageView.java:182)
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderWithTemplateEngine(GroovyPageView.java:153)
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderMergedOutputModel(GroovyPageView.java:84)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
    at org.codehaus.groovy.grails.web.sitemesh.SpringMVCViewDecorator.render(SpringMVCViewDecorator.java:67)
    ... 51 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:include>: Unable to execute include: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: java.lang.IllegalStateException: Cannot reset buffer after response has been committed
    at org.codehaus.groovy.grails.web.pages.GroovyPage.throwRootCause(GroovyPage.java:531)
    at org.codehaus.groovy.grails.web.pages.GroovyPage.invokeTag(GroovyPage.java:475)
    at sun.reflect.GeneratedMethodAccessor379.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:989)
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at mycompany_dev_testuserdev_ws3_myapp_grails_app_views_layouts_main_gsp$_run_closure2.doCall(main.gsp:229)
Run Code Online (Sandbox Code Playgroud)

Lar*_*ari 5

将Config.groovy和BuildConfig.groovy文件与空的新Grails 2.3应用程序的默认值进行比较.

最值得注意的变化是不再在application.properties中描述插件依赖性.您还应该确保使用正确版本的Grails Tomcat,Hibernate和Scaffolding插件.Tomcat和Hibernate插件版本不再与Grails发行版本相同.已经提取脚手架功能来分离Grails 2.3中的插件.还要确保使用正确的插件范围(为tomcat构建,为hibernate运行时).

还建议开始使用基于maven的新maven(使用作为maven一部分的aether库)依赖性解析.这是通过grails.project.dependency.resolver = "maven"BuildConfig.groovy中的设置完成的.我在Grails 2.3中使用旧的基于常春藤的解析器遇到了奇怪的类加载问题.

我希望这有帮助.