Releases: apache/grails-core
Grails 1.2.4
Grails 1.2.4 is a minor release of Grails with bug fixes and improvements.
Further information about the release can be obtained using the links below:
See the Grails 1.2 release notes for more information about new features.
Create scripts purge redundant artifact suffixes
Improved the create scripts to handle redundant artifact suffixes.
For example:
grails create-service com.example.FooService
now creates /com/example/FooService.groovy instead of /com/example/FooServiceService.groovy
Applies to:
- create-controller
- create-filters
- create-service
- create-taglib
- create-integration-test
- create-unit-test
See GRAILS-6381 for more detail
Create Skinny Wars With Plugin Dependencies Included
See GRAILS-6422 for more detail
Grails 1.3.4
For further information about the release see the below links:
Groovy 1.7.4
Grails 1.3.4 includes Groovy 1.7.4. Read the Groovy 1.7.4 Release Notes for details on the latest version of the Groovy language.
Create scripts purge redundant artifact suffixes
Improved the create scripts to handle redundant artifact suffixes.
For example:
grails create-service com.example.FooService
now creates /com/example/FooService.groovy
instead of /com/example/FooServiceService.groovy
Applies to:
- create-controller
- create-filters
- create-service
- create-taglib
- create-integration-test
- create-unit-test
See GRAILS-6381 for more detail
Grails 1.3.3
8th of July 2010
Further information about the release can be obtained using the links below:
This release includes previous fixes in 1.3.x release train.
Grails 1.2.3
Grails 1.2.3 is a minor release of Grails with bug fixes and improvements.
Further information about the release can be obtained using the links below:
See the Grails 1.2 release notes for more information about new features.
Grails 1.3.2
17th of June 2010
Grails is a dynamic web application framework built on Java and Groovy, leveraging best of breed APIs from the Java EE sphere including Spring, Hibernate and SiteMesh. Grails brings to Java and Groovy developers the joys of convention-based rapid development while allowing them to leverage their existing knowledge and capitalize on the proven and performant APIs Java developers have been using for years.
Further information about the release can be obtained using the links below:
This release includes previous fixes in 1.3.x release train.
Groovy 1.7.3 Support
Grails 1.3.2 comes with the recently released 1.7.3 version of the Groovy language. See the Groovy 1.7.3 Release Notes for info.
Spring 3.0.3 Support
Grails 1.3.2 comes with the recently released 3.0.3 version of The Spring Framework. See the Spring 3.0.3 Release Notes for info.
Typo detection for scripts
If you mis-type a script name, Grails will find the closest matches to what you typed and prompt you to choose from a list of existing scripts:
~/workspace/testapp $ grails create-doman-class testapp.Author
Welcome to Grails 1.3.2 - http://grails.org/
Licensed under Apache Standard License 2.0
...
Script 'CreateDomanClass' not found, did you mean:
1) CreateDomainClass
2) CreateApp_
3) CreateScript
4) CreateFilters
5) CreateUnitTest
Please make a selection or enter Q to quit:
The .find Method Now Supports The Query Cache
def musicians = Musician.find('from Musician where name = :name', [name: 'Brian'], [cache: true])
Improved Support for HTTP proxies
Grails' command line has been improved to support multiple different proxy configurations:
grails add-proxy client --host=proxy-server --port=4300 --username=guest --password=guest
grails set-proxy client
grails clear-proxy
grails add-proxy local --host=localhost --port=4300
grails set-proxy local
Grails 1.3.1
17th May 2010
Further information about the release can be obtained using the links below:
Filter Ordering
The order in which filters are executed may now be influenced by expressing that a filter depends on some number of other filters.
class MyFilters {
def dependsOn = [MyOtherFilters]
def filters = {
...
}
}
class MyOtherFilters {
def filters = {
...
}
}
GSP Tag "unless"
A new GSP tag has been provided called "unless", which acts as a counterpart to the existing "if" tag.
<g:unless test="${cacheEnabled}">
Tag Body Goes Here
</g:unless>
Improved Query Caching
The findAll query method now supports taking advantage of the 2nd level cache.
Book.findAll("from Book as b where b.author=:author", [author:'Dan Brown'], [cache: true])
Nested Named Queries
Named queries may now be nested.
class Publication {
String title
String author
Date datePublished
Integer numberOfPages
static namedQueries = {
recentPublications {
def now = new Date()
gt 'datePublished', now - 365
}
publicationsWithBookInTitle {
like 'title', '%Book%'
}
recentPublicationsWithBookInTitle {
// calls to other named queries...
recentPublications()
publicationsWithBookInTitle()
}
}
}
TagLib Testing
TagLibUnitTestCase now supports testing custom tags that access the dynamic pageScope property. The pageScope property is now dynamically added to tag libraries at test time.
Grails 1.3.0
11th of May 2010
SpringSource are pleased to announce the 1.3 release of the Grails web application development framework.
Further information about the release can be obtained using the links below:
Groovy 1.7 Support
Grails 1.3 comes with the recently released 1.7 version of the Groovy language, which includes loads of new features like anonymous and nested class support, power asserts and more. See the Groovy 1.7 release notes for info.
JUnit 4
Grails 1.3 now uses JUnit 4 to run tests. JUnit 4 features a richer assertion API and many features like timeouts, ignores, class level before and after methods, hamcrest matchers, assumptions, theories and more.
Pre Grails 1.3 tests are fully backwards compatible.
Improvements to Modular Plugin Development
There are a couple of significant improvements to modular application development with plugins:
- You can now override any plugin provides class, view or template simply by creating an equivalent class (same package/class name) or GSP in your application
- You now no longer need to run package-plugin in each inline plugin prior to using or building a WAR file
Maven Repository Support
Grails now has full support for publishing plugins to (using the [maven publisher|http://grails.org/plugin/maven-publisher] plugin) and reading plugins from Maven compatible repositories.
You can easily configure additional plugin repositories in BuildConfig.groovy using the Ivy DSL introduced in Grails 1.2:
repositories {
mavenRepo "http://repository.codehaus.org"
}
The [central Grails repository|http://grails.org/plugin/home] can also now be easily enabled and disabled by including using the @grailsCentral@ method:
repositories {
grailsCentral()
}
Declarative Plugin Dependencies
Alongside the new Maven repository support you can now declare plugin dependencies using the Ivy DSL:
plugins {
runtime ':hibernate:1.2.1'
}
Which allows you to easily control plugin exclusions:
plugins {
runtime( ':weceem:0.8' ) {
excludes "searchable"
}
}
And the scope of a plugin:
plugins {
build( ':weceem:0.8' )
}
Dirty Checking in GORM
GORM includes new methods to check whether an object has been modified:
def airport = Airport.get(10)
assert !airport.isDirty()
airport.properties = params
if (airport.isDirty()) {
// do something based on changed state
}
You can also check if individual fields have been modified:
def airport = Airport.get(10)
assert !airport.isDirty()
airport.properties = params
if (airport.isDirty('name')) {
// do something based on changed name
}
GORM Support For Derived Properties
GORM now provides a mechanism for taking advantage of Hibernate's derived properties support.
class Product {
Float price
Float finalPrice
static mapping = {
finalPrice formula: 'PRICE * 1.155'
}
}
Named Queries Support Additional Criteria
Additional criteria may be supplied to named queries at invocation time:
class Publication {
String title
String author
Date datePublished
Integer numberOfPages
static namedQueries = {
recentPublications {
def now = new Date()
gt 'datePublished', now - 365
}
}
}
def books = Publication.recentPublications {
or {
like 'author', 'Tony%'
like 'author', 'Phil%'
}
}
Chaining Named Criteria
Named criteria may be chained together. When criteria are chained together, the query will be generated
as if all of the chained criteria had been combined in a single criteria closure.
// recent publications with 'Book' in the title
def books = Publication.recentPublications.publicationsWithBookInTitle.list()
// old publications with more than 500 pages and with 'Book' in the title
def books = Publication.oldPublicationsLargerThan(500).publicationsWithBookInTitle.list()
Global application layouts
You can now define a layout to be used by all pages that don't specifiy one otherwise by creating a @grails-app/views/layouts/application.gsp@ file. The name of the layout to use can also be modified in Config.groovy:
grails.sitemesh.default.layout='myLayoutName'
New GSP Tag - join
<g:join in="['Grails', 'Groovy', 'Gradle']" delimiter="_"/>
Produces:
Grails_Groovy_Gradle
PDF Publishing for Grails doc
The 'grails doc' command can now produce a PDF document from your user documentation sources:
grails doc --pdf
An easy way to create a template grails doc project has also been introduced:
grails doc --init
Grails 1.2.2
Grails 1.2.2 is a minor release of Grails with bug fixes and improvements.
Further information about the release can be obtained using the links below:
See the Grails 1.2 release notes for more information about new features.
Grails 1.2.1
Grails 1.2.1 is a minor release of Grails with bug fixes and improvements.
Further information about the release can be obtained using the links below:
See the Grails 1.2 release notes for more information about new features.
Grails 1.2.0
23rd of December 2009
SpringSource are pleased to announce the 1.2 release of the Grails web application development framework.
New features in 1.2 are described below.
New Features
Dependency Resolution DSL
Grails 1.2 features a new DSL for configuring JAR dependencies that can be resolved against Maven repositories:
grails.project.dependency.resolution = {
inherits "global" // inherit Grails' default dependencies
repositories {
grailsHome()
mavenCentral()
}
dependencies {
runtime 'com.mysql:mysql-connector-java:5.1.5'
}
}
Built on Apache Ivy, users can now explicitly control how Grails resolves all of its dependencies without needing to use Maven or Apache Ivy directly.
There is also a new command to easily install dependencies into your local cache for use with the DSL:
grails install-dependency mysql:mysql-connector-java:5.1.5
Significant Performance Optimizations
GSP and the Sitemesh rendering layer have been significantly improved to offer 2 to 3 times better throughput. This was achieved by:
- Output buffering has been refactored to a streaming approach: the minimum amount of new objects are created.
- Tag library calls return an instance of org.codehaus.groovy.grails.web.util.StreamCharBuffer class by default.
- Tag libraries can now return object values too. This was changed to reduce object generation.
- Sitemesh doesn't have to parse the output coming from GSP since the head, meta, title and body tags are captured from the beginning. This is done in GSP compilation when the config param "grails.views.gsp.sitemesh.preprocess" is unset or is true.
- Some performance improvements are the result of monitoring for unnecessary Exceptions created in Grails and preventing them from happening.
Thanks to @lhotari for his significant contributions to Grails in this area.
BootStrap environments
The BootStrap.groovy class now has environment support:
def init = { ServletContext ctx ->
environments {
production {
ctx.setAttribute("env", "prod")
}
development {
ctx.setAttribute("env", "dev")
}
}
ctx.setAttribute("foo", "bar")
}
Spring 3 Upgrade
Grails now also supports Spring annotation prototypes through component scanning such as @Service, @Component etc.
In order to do so you need to tell Grails which packages your Spring beans are contained within in Config.groovy. For example:
grails.spring.bean.packages = \['com.foo.stuff','com.foo.otherstuff'\]
Any class can be annotated with @Component and will automatically become a Spring bean injectable in other classes.
In addition you can annotate classes with @Controller and these will be able to handle requests just like regular Spring MVC controllers, thus providing support for those wanting to use a combination of Spring MVC and Grails:
@Controller
class SpringController {
@Autowired
SessionFactory sessionFactory
@RequestMapping("/hello.dispatch")
ModelMap handleRequest() {
def session = sessionFactory.getCurrentSession()
return new ModelMap(session.get(Person, 1L))
}
}
In this example, going to /hello.dispatch will execute the handleRequest() method and atempt to render either a GSP or JSP view at grails-app/views/hello.(jsp|gsp)
URI Re-writing onto any URI
You can now re-write any request URI onto any other URI using the following syntax in your grails-app/conf/UrlMappings.groovy file:
"/hello"(uri:"/hello.dispatch")
This feature can be used to provide pretty URIs for Spring MVC controllers (see above) or static resources.
Per-method transactions with @transactional
Building on the component scanning features you can now use the Spring org.springframework.transaction.annotation.Transactional annotation on Grails service classes to configure transaction properties and have per-method transaction definitions:
import org.springframework.transaction.annotation.*
class BookService {
@Transactional(readOnly = true)
def listBooks() {
Book.list()
}
@Transactional
def updateBook() {
// ...
}
}
{code}
Fine-grained control over DataSource properties
The DataSource.groovy file now provides control over all of the underlying DataSource bean's properties:
dataSource {
pooled = true
dbCreate = "update"
url = "jdbc:mysql://localhost/yourDB"
driverClassName = "com.mysql.jdbc.Driver"
username = "yourUser"
password = "yourPassword"
properties {
maxActive = 50
maxIdle = 25
minIdle = 5
initialSize = 5
minEvictableIdleTimeMillis = 60000
timeBetweenEvictionRunsMillis = 60000
maxWait = 10000
}
}
Global Configuration of GORM defaults
GORMs default mapping settings are now globally configurable inside @grails-app/conf/Config.groovy@:
grails.gorm.default.mapping = {
cache true
id generator:'sequence'
'user-type'( type:org.hibernate.type.YesNoType, class:Boolean )
}
The default values for constraints is also globally configurable:
grails.gorm.default.constraints = {
'*'(nullable:true, blank:false, size:1..20)
}
You can even define named constraint groups:
grails.gorm.default.constraints = {
myConstraints(nullable:true, blank:false, size:1..20)
}
And then reuse them inside your domain classes:
static constraints = {
myProperty shared:"myConstraints"
}
Improved Dynamic Finders for Boolean properties
GORM dynamic finders have been improved with an easier notation for handling boolean properties. For example given a domain class of:
class Book {
String title
String author
Boolean paperback
}
You can do:
def results = Book.findAllPaperbackByAuthor("Douglas Adams")
or
def results = Book.findAllNotPaperbackByAuthor("Douglas Adams")
In this case the boolean value is implicitly inferred from the method signature.
Named Query Support
GORM now supports defining named queries in a domain class. For example, given a domain class like this:
class Publication {
String title
Date datePublished
static namedQueries = {
recentPublications {
def now = new Date()
gt 'datePublished', now - 365
}
publicationsWithBookInTitle {
like 'title', '%Book%'
}
}
}
You can do:
// get all recent publications
def recentPubs = Publication.recentPublications.list()
// get up to 10 recent publications, skip the first 5...
def recentPubs = Publication.recentPublications.list(max: 10, offset: 5)
// get the number of recent publications...
def numberOfRecentPubs = Publication.recentPublications.count()
// get a recent publication with a specific id...
def pub = Publication.recentPublications.get(42)
// dynamic finders are supported
def pubs = Publication.recentPublications.findAllByTitle('Some Title')
Support for SQL restriction in criteria builder
The criteria builder now supports arbitrary SQL expressions:
def c = Person.createCriteria()
def peopleWithShortFirstNames = c.list {
sqlRestriction "char_length( first_name ) <= 4"
}
Support for hasOne mapping
GORM now supports @hasone@ mapping where the foreign key is stored in the child instead of the parent association. For example:
class Person {
String name
static hasOne = [address: Address]
}
class Address {
String street
String postCode
}
In the above case a foreign key column called @person_id@ will be created in the @address@ table rather than the default where an @address_id@ is created in the @person@ table.
Strict Validation Errors
There is a new @failOnError@ argument available on the @save()@ method that will throw an exception if a validation error occurs:
try {
book.save(failOnError:true)
}
catch(ValidationException e) {
// handle
}
Improved support for annotated entities
You can now use annotated entities instead of the GORM syntax inside domains located in grails-app/domain. These entities can use Grails constraints and events just like normal GORM entities for those who prefer annotations over GORM syntax:
import javax.persistence.*
@Entity
@Table(name = "animal")
class Animal {
@Id @GeneratedValue
int id
String name
@ManyToOne
@JoinColumn
Owner owner
static constraints = {
name blank:false
}
}
Precompilation of Groovy Server Pages in WAR deployment
GSPs are now pre-compiled when producing a WAR file meaning less permgen space is used at deployment time for Grails applications.
Improved handling of i18n class and property names
You can now put entries in your i18n messages.properties file for all class and property names in your application. For example:
book.label = Libro
book.title.label = TÃtulo del libro
These are then picked up by Grails' default error messages and scaffolded views.
Tomcat & Multiple Embedded Containers Supported
Grails now supports multiple embedded containers with Tomcat being the default. Grails will by default install the Tomcat plugin into your application. You can easily switch containers by switching plugins:
grails uninstall-plugin tomcat
grails install-plugin jett...