$ grails
An Introduction to the Grails Framework
Søren Berg Glasius
whoami
Søren Berg Glasius
Java developer since y2k
Groovy & Grails developer since y2k+9
OCI Grails Team Member
GR8Conf co-founder and organizer
Nerd By Nature
Groovy And Grails Project Work
Grails 2 → 3 Plugin Migrations
Grails Plugin Development
Grails Core Development
We are hiring!
Grails
Whats in the box?
The stack
How does it work?
Demo!
Q/A
a deep dive into Grails
Introduction
Grails is a powerful web framework, for the Java platform aimed at multiplying developers’ productivity thanks to a Convention-over-Configuration, sensible defaults and opinionated APIs.
It integrates smoothly with the JVM, allowing you to be immediately productive whilst providing powerful features including integrated ORM, Domain-Specific Languages, runtime and compile-time meta-programming and Asynchronous programming.
A Object Relational Mapping (ORM) called GORM
simplifies Hibernate
partly DB agnostic
provides NoSQL access
A controller layer built on Spring MVC
Groovy Server Pages view technology (GSP’s)
An embedded Tomcat container
On the fly reloading when artifacts changes
Spring dependency injection
Internationalization support (i18n)
A transactional service layer
Easy TagLib creation
A well defined plugin structure
A command line tool
Build-system based on Gradle
Groovy adj. (or, less commonly, "Groovie" or "Groovey") It is roughly synonymous with words such as "cool", "excellent", "fashionable" or "amazing," depending on context.
— Wikipedia
Groovy adj. (or, less commonly, "Groovie" or "Groovey") It is roughly synonymous with words such as "cool", "excellent", "fashionable" or "amazing," depending on context.
— Wikipedia
Groovy is a powerful, optionally typed and dynamic language, with static typing and static compilation capabilities, for the Java platform aimed at multiplying developers’ productivity thanks to a concise, familiar and easy to learn syntax.
It integrates smoothly with any Java program, and immediately delivers to your application powerful features, including scripting capabilities, Domain-Specific Language authoring, runtime and compile-time meta-programming and functional programming.
www.groovy-lang.org
Don’t Repeat Yourself
Grails is opinionated.
Keeping config to a minimum.
Have a Java 8 JDK installed
Download Grails (www.grails.org/downloads)
Unzip archive
$ grails
| Enter a command name to run. Use TAB for completion:
grails> _ ->|
create-app create-plugin create-profile gradle help list-profiles open
profile-info
grails> _
$ grails
| Enter a command name to run. Use TAB for completion:
grails> list-profiles_
| Available Profiles
--------------------
* angular - A profile for creating applications using AngularJS
* rest-api - Profile for REST API applications
* base - The base profile extended by other profiles
* angular2 - A profile for creating Grails applications with Angular 2
* plugin - Profile for plugins designed to work across all profiles
* profile - A profile for creating new Grails profiles
* react - A profile for creating Grails applications with a React frontend
* rest-api-plugin - Profile for REST API plugins
* web - Profile for Web applications
* web-plugin - Profile for Plugins designed for Web applications
* webpack - A profile for creating applications with node-based frontends using webpack
grails> _
$ grails
| Enter a command name to run. Use TAB for completion:
grails> create-app_ ->|
.
├── build.gradle
├── gradle (wrapper)
├── gradle.properties
├── grails-app
│ ├── assets (images, stylesheets, javascript)
│ ├── conf
│ │ └── spring
│ │ └── resources.groovy
│ ├── controllers
│ │ └── UrlMappings.groovy
│ ├── domain
│ ├── i18n (Internationalization)
│ ├── init
│ │ ├── BootStrap.groovy
│ │ └── grails
│ │ └── demo
│ │ └── Application.groovy
│ ├── services
│ ├── taglib
│ ├── utils
│ └── views
│ ├── error.gsp
│ ├── index.gsp
│ ├── layouts
│ │ └── main.gsp
│ └── notFound.gsp
├── src
│ ├── integration-test
│ │ └── groovy
│ ├── main
│ │ ├── groovy
│ │ └── webapp
│ └── test
│ └── groovy
Controllers
Views
Services
Domain Objects
Scaffolding
I18n
Sensible defaults
Tag-libraries
Plugins
Grails
Opinionated
DRY: Don’t Repeat Yourself
Focus on business logic, Grails handles the rest
Deploys as a regular WAR file
Builds on Spring, Hibernate and Sitemesh
Highly extensible plugin structure
Write less, do more
and answers?
Søren Berg Glasius