I prefer this Grails web framework, the Major has reached version 2. Given the wealth of new features, the 2 is more than justified before the dot. A good overview about what has changed, offers the article " What's new in Grails 2.0 "by Dierk König.
For me it was worth the new interactive Grails Console with TAB-completion, colored, one-line output and error output formatted the upgrade. It is primarily for the instruction execution is much faster because it does not own JVM must be started.
As a test candidate had my example Grails application grum (source code on Google Code ) serve. But as simple as a minor upgrade from one version to another was not.
The first thing that you should upgrade instructions internalize, because a simple grails upgrade resulted in me becoming one of inconsistent project in my development environment ( SpringSource Tool Suite ).
It is mostly to blame themselves, but where now are the pitfalls?
Dependency Management
One topic that I had ignored until now complete, was the dependency management. In previous Grails versions were all needed libraries (such as JDBC drivers) in the lib directory. Clean, it is natural to declare the dependencies. In Grails makes this into the buildconfig class.
conf / BuildConfig.groovy
dependencies { / / Specify dependencies hereunder either / / 'Build', 'compile', 'runtime', 'test' or 'provided' scopes eg. runtime 'mysql: mysql-connector-java: 1.5.16' build "DisplayTag: DisplayTag: 1.2" runtime "DisplayTag: DisplayTag-export-poi: 1.2" runtime "DisplayTag: itext: 1.3" runtime "DisplayTag: poi: 3.2" }
After that you should in the IDE via the Grails dependencies Tools -> Refresh Refresh Dependencies. If this is not (like me) it helps to stop the dependency management and launch it.
- Grails Tools -> Disable dependency management
- Grails Tools -> Enable Dependency Management
Alternatively, you can settle in the Grails console the following commands:
grails> clean grails> was
Plugins
It came with me to compile problems associated with the automatically installed plugins jquery and resources, I could only fix by reinstalling the plug-ins
plugin-name > grails> uninstall-plugin <plugin-name> plugin-name > grails> install-plugin 'plugin-name>
Taglibs
And where you have been cleaning up is. The day is createLinkTo depracted resources and should be replaced by the day. At this point one should also pay attention to upgrade the following notice:
If you install Resources (or it is installed automatically), the day will not write anything like <g:javascript> to the page until you add the <r:layoutResources/> tags to your layout.
Content Negotiation
One point is why I like Grails Sun, so that can be implemented very easily REST APIs. This has also changed in version 2.0 something. The content negotiation depends no longer on the accepted format of the responses, but by the content type of the request.
For this we must replace the code with format by request.withFormat. You can test this change with curl . For example, with:
xml http: // localhost: 8080 / grum / contactData / list curl - header content-type: text / xml http:// localhost: 8080 / grum / contact data / list
Conclusion:
The upgrade is worthwhile, even if it is connected with a little more work than usual
Links:
grum - Grails 2.0 Example application






