Groovy/Grails update  drukuj

Autor: Krzysztof Konwisarz
Tagi:

Groovy and Grails releases in the last months appear so often that it is really easy to miss them. Starting with Groovy: it’s current version is 1.7.4, and the maintenance updates from this branch bring little more than bugfixes, so the below list contains mainly the changes introduced in 1.7.0:

  • anonymous inner classes – for Java compatibility

  • nested static classes – functionality exists, but it is best to use static nested classes if any

  • added annotations on imports, packages and variable declarations – this allows for instance to declare dependencies with Grape within your code

  • more readable asserts output with Power Asserts

  • AST Viewer and AST Builder to facilitate the use of AST transformations

  • Groovy Truth expanded – every class now can customize the way it is evaluated to boolean by implementing its asBoolean() method

  • batch updates using sql.witchBatch() and sql.withTransaction()

  • numerous improvements in testing, collection methods, GroovyScriptEngine, Groovy console and other

More on this, especially the exact behavior and limitation of nested classes in Groovy 1.7.0 Release Notes.

 

Unlike in Goovy, in each of Grails 1.3.x branch releases new features are implemented. Its current version (1.3.4) uses Spring 3.0.3. With 1.3.0 and the following quite a few changes were made:

  • GORM:

    • dirty checking for domain classes with .isDirty() and .isDirty(‘fieldName’) methods

    • Hibernate derived properties – domain class property value can be now calculated from a formula; here is a nice post on derived properties themselves.

    • named queries can be combined – nested within another named query, chained one by one or made more specific by supplying additional conditions when invoked

    • .find() and .findAll() query results can now be cached

  • GSPs:

    • default layout – if defined, it will be used by all pages that do not explicitly declare to use one

    • <g:join> tag concatenates strings separating them with a specified delimiter

    • <g:unless> tag is a handier version of negated <g:if>

  • filters

    • the order in which filters are executed can be specified

  • testing:

    • upgraded to JUnit 4

    • TagLib testing allows to test custom tags that use the pageScope property

  • plugins

    • classes, views and templates provided by plugins can be overridden

    • inline plugins don’t have to be plugin-packaged before use

  • dependency management:

    • you can specify plugin repositories you want to use in BuildConfig.groovy

    • publishing plugins on Maven compatible repositories

    • declaring plugin dependencies with the IvyDSL

  • every-day use:

    • script name typo detection in command line

    • when creating artifacts suffixes like *Controller, *Service are now added only when user hasn’t supplied one

    • multiple HTTP proxy configuration

    • grails doc –-pdf exports generated documentation to PDF and –-init generates a documentation template

Grails release notes for more details:

http://www.grails.org/1.3 Release Notes

http://www.grails.org/1.3.1 Release Notes

http://www.grails.org/1.3.2 Release Notes

http://www.grails.org/1.3.4 Release Notes

 

As for IDEs – having used Netbeans and Spring Tools Suite lately I must say, that the latter is a long awaited improvement in Groovy/Grails free IDE support. There is still a lot to be done, but at the moment syntax highlighting works quite well, code completions gives some hints without making you wait for ages, and even refactoring works sometimes ;).

 

  • Karol,

    very goog article. good work men   Odpowiedz

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany.
Wymagane jest wypełnienie pól oznaczonych symbolem *.

*


Poleć znajomemu



* - pola wymagane