SlideShare a Scribd company logo
1 of 19
Grails Plugins
By : Vijay Shukla
Content
1. Introduction
2. Console
3. DB Migration
4. Asset Pipeline
5. Pagination
Introduction
A Grails plugin is a self-contained bundle of functionality that can
be installed into a Grails application.
When you install a Grails plugin, that plugin's functionality is made
available to the installing application.
Console
Console plugin provides a web-based Groovy console for interactive runtime application
management and debugging.
Dependency:
compile "org.grails.plugins:console:1.5.7"
plugins {
runtime ':console:1.5.7'
}
Console
restricting access to localhost Ips:
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
"/console/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') ||
hasIpAddress('::1'))"],
"/plugins/console*/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') ||
hasIpAddress('::1'))"]
]
Console Plugin Key Commands
Ctrl-Enter / Cmd-Enter-> Execute
Ctrl-S / Cmd-S -> Save
Esc -> Clear output
Link:(For properties and their description)
https://github.com/sheehan/grails-console/blob/master/README.md
DB Migration
The Database Migration plugin helps you manage database changes while developing Grails
applications.
The plugin uses the Liquibase library.
All of the scripts start with dbm- to ensure that they're unique ,
and don't clash with scripts from Grails or other plugins.
DB Migration
Dependency: runtime "org.grails.plugins:database-migration:1.4.1"
grails dbm-generate-changelog changelog.groovy
grails-app/migrations/, you should see a file there called changelog.groovy
Command: grails dbm-gorm-diff
Config.groovy: grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
DB Migration
1. To create a changelog from the database, use the dbm-generate-changelog script:
grails dbm-generate-changelog changelog.groovy
or
grails dbm-generate-changelog changelog.xml
2. To create a changelog from your domain classes, use the dbm-generate-gorm-changelog script:
grails dbm-generate-gorm-changelog changelog.groovy
or
grails dbm-generate-gorm-changelog changelog.xml
3. grails dbm-update
DB Migration
grails dbm-gorm-diff 2012-02-01-initial-database.groovy --add
databaseChangeLog = {
include file: '2012-02-01-initial-database.groovy'
}
Remote Pagination
Dependency:
compile "org.grails.plugins:remote-pagination:0.4.8"
Remote Pagination
The remote-pagination plugin currently provides the following tags:
remotePaginate
remoteSortableColumn
remotePageScroll
remoteNonStopPageScroll
Remote Pagination
<util:remotePaginate controller="book" action="filter" total="${Book.count()}"
update="listTemplateDivId" max="20" pageSizes="[10, 20, 50,100]"/>
<util:remotePaginate controller="book" action="filter" total="${Book.count()}"
update="listTemplateDivId"
max="20" pageSizes="[10:'10 Per Page', 20: '20 Per Page', 50:'50 Per Page',100:'100 Per Page']"/>
Asset Pipeline Plugin
The Asset-Pipeline is a plugin used for managing and processing
static assets in Grails applications. Asset-Pipeline functions include
processing and minification of both CSS and JavaScript files.
The asset-pipeline levereges the latest in minification (UglifyJS) to
reduce your asset sizes as much as possible.
Asset Pipeline Plugin
Dependency:
compile "org.grails.plugins:asset-pipeline:2.11.0"
Asset-Pipeline automatically creates a series of folders within your grails-app directory:
grails-app/assets/javascript ,
grails-app/assets/images,
grails-app/assets/stylesheets
Asset Pipeline Plugin
Including Assets in your Views
Asset pipeline provides several new tag libs for including javascript and css into your gsp files.
Example:
<head>
<asset:javascript src="application.js"/>
<asset:stylesheet href="application.css"/>
</head>
Asset Pipeline Plugin
NOTE: In development mode your stylesheets and javascripts will be included as individual script tags.
This is intended to make it easier for debugging. Bundling is enabled in all other environments and can
be forced in development mode by adding
grails.assets.bundle=true
to your Config.groovy.
During war build your assets are also minified using UglifierJs. To disable this feature you can add the
following option to your config:
grails.assets.minifyJs = false
Thank You

More Related Content

What's hot

Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
Shinichi Ogawa
 
Creating REST Webservice With NetBeans
Creating REST Webservice With NetBeansCreating REST Webservice With NetBeans
Creating REST Webservice With NetBeans
Neil Ghosh
 

What's hot (20)

Offline First with Service Worker
Offline First with Service WorkerOffline First with Service Worker
Offline First with Service Worker
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
PWA 與 Service Worker
PWA 與 Service WorkerPWA 與 Service Worker
PWA 與 Service Worker
 
Service oriented web development with OSGi
Service oriented web development with OSGiService oriented web development with OSGi
Service oriented web development with OSGi
 
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R AugeHTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
 
DevRock #01 What's new ASP.net 5
DevRock #01 What's new ASP.net 5DevRock #01 What's new ASP.net 5
DevRock #01 What's new ASP.net 5
 
Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
 
Open Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjpOpen Service Broker APIとKubernetes Service Catalog #k8sjp
Open Service Broker APIとKubernetes Service Catalog #k8sjp
 
Web Automation Testing Using Selenium
Web Automation Testing Using SeleniumWeb Automation Testing Using Selenium
Web Automation Testing Using Selenium
 
Asp.net identity 2.0
Asp.net identity 2.0Asp.net identity 2.0
Asp.net identity 2.0
 
Service workers
Service workersService workers
Service workers
 
Alfresco devcon 2019: How to track user activities without using the audit fu...
Alfresco devcon 2019: How to track user activities without using the audit fu...Alfresco devcon 2019: How to track user activities without using the audit fu...
Alfresco devcon 2019: How to track user activities without using the audit fu...
 
REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
 
AtlasCamp 2015: How HipChat ships at the speed of awesome
AtlasCamp 2015: How HipChat ships at the speed of awesomeAtlasCamp 2015: How HipChat ships at the speed of awesome
AtlasCamp 2015: How HipChat ships at the speed of awesome
 
Web Api vs MVC
Web Api vs MVCWeb Api vs MVC
Web Api vs MVC
 
API Days Australia - Automatic Testing of (RESTful) API Documentation
API Days Australia  - Automatic Testing of (RESTful) API DocumentationAPI Days Australia  - Automatic Testing of (RESTful) API Documentation
API Days Australia - Automatic Testing of (RESTful) API Documentation
 
Creating REST Webservice With NetBeans
Creating REST Webservice With NetBeansCreating REST Webservice With NetBeans
Creating REST Webservice With NetBeans
 
Web Deployment With Visual Studio 2010
Web Deployment With Visual Studio 2010Web Deployment With Visual Studio 2010
Web Deployment With Visual Studio 2010
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14Cejv659 week09 glassfish-s14
Cejv659 week09 glassfish-s14
 

Similar to Grails plugin

Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
Christopher Schmitt
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
yangdj
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver
yangdj
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
Mike Hugo
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
catherinewall
 

Similar to Grails plugin (20)

Let's play with adf 3.0
Let's play with adf 3.0Let's play with adf 3.0
Let's play with adf 3.0
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
After max+phonegap
After max+phonegapAfter max+phonegap
After max+phonegap
 
混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver混搭移动开发:PhoneGap+JQurey+Dreamweaver
混搭移动开发:PhoneGap+JQurey+Dreamweaver
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 
Grails Advanced
Grails Advanced Grails Advanced
Grails Advanced
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Infrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and OpsInfrastructure-as-code: bridging the gap between Devs and Ops
Infrastructure-as-code: bridging the gap between Devs and Ops
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Google Cloud Endpointsによる API構築
Google Cloud Endpointsによる API構築Google Cloud Endpointsによる API構築
Google Cloud Endpointsによる API構築
 
QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger QtDD13 - Qt Creator plugins - Tobias Hunger
QtDD13 - Qt Creator plugins - Tobias Hunger
 
The Google App Engine Oil Framework
The Google App Engine Oil FrameworkThe Google App Engine Oil Framework
The Google App Engine Oil Framework
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 

More from Vijay Shukla

More from Vijay Shukla (20)

Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4
 
Preview of Groovy 3
Preview of Groovy 3Preview of Groovy 3
Preview of Groovy 3
 
Jython
JythonJython
Jython
 
Groovy closures
Groovy closuresGroovy closures
Groovy closures
 
Groovy
GroovyGroovy
Groovy
 
Grails services
Grails servicesGrails services
Grails services
 
Grails domain
Grails domainGrails domain
Grails domain
 
Grails custom tag lib
Grails custom tag libGrails custom tag lib
Grails custom tag lib
 
Grails
GrailsGrails
Grails
 
Gorm
GormGorm
Gorm
 
Controller
ControllerController
Controller
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Command object
Command objectCommand object
Command object
 
Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovy
 
Vertx
VertxVertx
Vertx
 
Custom plugin
Custom pluginCustom plugin
Custom plugin
 
Spring security
Spring securitySpring security
Spring security
 
REST
RESTREST
REST
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfig
 
GORM
GORMGORM
GORM
 

Recently uploaded

Recently uploaded (20)

The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST API
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid Environments
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in Uganda
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 

Grails plugin

  • 1. Grails Plugins By : Vijay Shukla
  • 2. Content 1. Introduction 2. Console 3. DB Migration 4. Asset Pipeline 5. Pagination
  • 3. Introduction A Grails plugin is a self-contained bundle of functionality that can be installed into a Grails application. When you install a Grails plugin, that plugin's functionality is made available to the installing application.
  • 4. Console Console plugin provides a web-based Groovy console for interactive runtime application management and debugging. Dependency: compile "org.grails.plugins:console:1.5.7" plugins { runtime ':console:1.5.7' }
  • 5. Console restricting access to localhost Ips: grails.plugin.springsecurity.controllerAnnotations.staticRules = [ "/console/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') || hasIpAddress('::1'))"], "/plugins/console*/**": ["hasRole('ROLE_ADMIN') && (hasIpAddress('127.0.0.1') || hasIpAddress('::1'))"] ]
  • 6.
  • 7. Console Plugin Key Commands Ctrl-Enter / Cmd-Enter-> Execute Ctrl-S / Cmd-S -> Save Esc -> Clear output Link:(For properties and their description) https://github.com/sheehan/grails-console/blob/master/README.md
  • 8. DB Migration The Database Migration plugin helps you manage database changes while developing Grails applications. The plugin uses the Liquibase library. All of the scripts start with dbm- to ensure that they're unique , and don't clash with scripts from Grails or other plugins.
  • 9. DB Migration Dependency: runtime "org.grails.plugins:database-migration:1.4.1" grails dbm-generate-changelog changelog.groovy grails-app/migrations/, you should see a file there called changelog.groovy Command: grails dbm-gorm-diff Config.groovy: grails.plugin.databasemigration.updateOnStart = true grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.groovy']
  • 10. DB Migration 1. To create a changelog from the database, use the dbm-generate-changelog script: grails dbm-generate-changelog changelog.groovy or grails dbm-generate-changelog changelog.xml 2. To create a changelog from your domain classes, use the dbm-generate-gorm-changelog script: grails dbm-generate-gorm-changelog changelog.groovy or grails dbm-generate-gorm-changelog changelog.xml 3. grails dbm-update
  • 11. DB Migration grails dbm-gorm-diff 2012-02-01-initial-database.groovy --add databaseChangeLog = { include file: '2012-02-01-initial-database.groovy' }
  • 13. Remote Pagination The remote-pagination plugin currently provides the following tags: remotePaginate remoteSortableColumn remotePageScroll remoteNonStopPageScroll
  • 14. Remote Pagination <util:remotePaginate controller="book" action="filter" total="${Book.count()}" update="listTemplateDivId" max="20" pageSizes="[10, 20, 50,100]"/> <util:remotePaginate controller="book" action="filter" total="${Book.count()}" update="listTemplateDivId" max="20" pageSizes="[10:'10 Per Page', 20: '20 Per Page', 50:'50 Per Page',100:'100 Per Page']"/>
  • 15. Asset Pipeline Plugin The Asset-Pipeline is a plugin used for managing and processing static assets in Grails applications. Asset-Pipeline functions include processing and minification of both CSS and JavaScript files. The asset-pipeline levereges the latest in minification (UglifyJS) to reduce your asset sizes as much as possible.
  • 16. Asset Pipeline Plugin Dependency: compile "org.grails.plugins:asset-pipeline:2.11.0" Asset-Pipeline automatically creates a series of folders within your grails-app directory: grails-app/assets/javascript , grails-app/assets/images, grails-app/assets/stylesheets
  • 17. Asset Pipeline Plugin Including Assets in your Views Asset pipeline provides several new tag libs for including javascript and css into your gsp files. Example: <head> <asset:javascript src="application.js"/> <asset:stylesheet href="application.css"/> </head>
  • 18. Asset Pipeline Plugin NOTE: In development mode your stylesheets and javascripts will be included as individual script tags. This is intended to make it easier for debugging. Bundling is enabled in all other environments and can be forced in development mode by adding grails.assets.bundle=true to your Config.groovy. During war build your assets are also minified using UglifierJs. To disable this feature you can add the following option to your config: grails.assets.minifyJs = false