### Example Multi-Project Setup Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/create-multi-project-build.html This example demonstrates the typical workflow: creating an application and plugins, then running the `create-multi-project-build` command. The generated `pom.xml` will include dependencies for the plugins. ```bash $ grails create-app myapp $ grails create-plugin plugin1 $ grails create-plugin plugin2 $ grails create-multi-project-build org.mycompany:parent:1.0 ``` ```xml org.grails.plugins plugin1 0.1 zip compile ``` -------------------------------- ### Install Plugin from URL Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/install-plugin.html Installs a plugin from a remote URL. This command is deprecated. ```bash grails install-plugin http://foo.com/grails-bar-1.0.zip ``` -------------------------------- ### Find First Book by Example Source: https://grails.apache.org/docs/2.5.5/ref/Domain%20Classes/find.html Use this to find the first book that matches the properties of a given example instance. ```groovy // query by example def example = new Book(author: "Dan Brown") Book.find(example) ``` -------------------------------- ### Install Plugin from Local File Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/install-plugin.html Installs a plugin from a local zip file. This command is deprecated. ```bash grails install-plugin ../grails-bar-1.0.zip ``` -------------------------------- ### Grails Help Output Example Source: https://grails.apache.org/docs/2.5.5/guide/commandLine.html Example output from the 'grails help' command, showing usage format and available targets. ```text Usage (optionals marked with *): grails [environment]* [target] [arguments]*Examples: grails dev run-app grails create-app booksAvailable Targets (type grails help 'target-name' for more info): grails bootstrap grails bug-report grails clean grails compile ... ``` -------------------------------- ### Example Plugin List Output Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/list-plugins.html This is an example of the typical output when listing available plugins, showing plugin name, version, and description. ```text Plugins available in the grailsCentral repository are listed below: ------------------------------------------------------------- acegi <0.5.3.2> -- Grails Spring Security 2.0 Plugin activemq <0.3> -- Grails ActiveMQ Plugin activiti <5.6> -- Grails Activiti Plugin ajax-uploader <0.3> -- Ajax Uploader Plugin ajaxflow <0.2.1> -- This plugin enables Ajaxified Webflows akismet <0.2> -- Akismet Anti-Spam Plugin alfresco <0.4> -- Plugin de integracion con Alfresco. ... ``` -------------------------------- ### Start Grails Console with Environment Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/console.html Starts the Grails console, optionally specifying one or more Grails environments. ```bash grails [environment]* console ``` -------------------------------- ### Example Output of list-plugin-updates Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/list-plugin-updates.html This is an example of the output you might see when running the list-plugin-updates command, showing plugins with available updates. ```text Plugins with available updates are listed below: ------------------------------------------------------------- acegi 0.4 0.5.2 console 0.1 0.2.2 ``` -------------------------------- ### Grails Controller Example Source: https://grails.apache.org/docs/2.5.5/ref/Tags/createLink.html An example controller for an application named 'shop' demonstrating list and show actions. ```groovy class BookController { static defaultAction = "list" def list() { [books: Book.list(params)] } def show() { [book: Book.get(params.id)] } } ``` -------------------------------- ### Example Controller for formRemote Source: https://grails.apache.org/docs/2.5.5/ref/Tags/formRemote.html This is an example controller that can be used with the formRemote tag to fetch book data. ```Groovy class BookController { def show() { [book: Book.get(params.id)] } def byAuthor() { [books: Book.findByAuthor(params.author, params)] } } ``` -------------------------------- ### Grails Controller Example Source: https://grails.apache.org/docs/2.5.5/ref/Tags/remoteLink.html Example controller for an application named 'shop' demonstrating actions that can be called remotely. ```Groovy class BookController { def list() { [books: Book.list(params)] } def show() { [book: Book.get(params.id)] } def bookByName() { [book: Book.findByName(params.bookName)] } } ``` -------------------------------- ### Start Grails Interactive Console Source: https://grails.apache.org/docs/2.5.5/guide/gettingStarted.html Navigate to your project directory and start the Grails interactive console to execute commands. ```bash cd helloworld grails ``` -------------------------------- ### Grails Controller Example Source: https://grails.apache.org/docs/2.5.5/ref/Tags/link.html An example Grails controller with 'list' and 'show' actions. This controller is used in subsequent link tag examples. ```groovy class BookController { def list() { [books: Book.list(params)] } def show() { [book : Book.get(params.id)] } } ``` -------------------------------- ### List Available Plugins Source: https://grails.apache.org/docs/2.5.5/guide/plugins.html Use this command to list all plugins available in the central repository. This command requires no setup. ```bash grails list-plugins ``` -------------------------------- ### Build Grails Installation from Source Source: https://grails.apache.org/docs/2.5.5/guide/contributing.html After cloning the repository, run this Gradle command from the project's root directory to build a Grails installation. This fetches dependencies and creates a GRAILS_HOME compatible structure. It skips the extensive test classes collection. ```bash ./gradlew install ``` -------------------------------- ### Initialize Project Documentation Template Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/doc.html Initializes a template for project documentation. Use this to set up the basic structure for your user guide. ```bash grails doc --init ``` -------------------------------- ### Grails Controller Example Source: https://grails.apache.org/docs/2.5.5/ref/Tags/remoteFunction.html This is an example controller for a Grails application that defines actions for listing, showing, and finding books. ```groovy class BookController { def list() { [books: Book.list(params)] } def show() { [book: Book.get(params.id)] } def bookByName() { [book: Book.findByName(params.bookName)] } } ``` -------------------------------- ### findAllBy* Examples Source: https://grails.apache.org/docs/2.5.5/ref/Domain%20Classes/findAllBy.html Demonstrates various ways to use the `findAllBy*` dynamic finder with different property conditions and operators. ```groovy def results = Book.findAllByTitle("The Shining", [max: 10, sort: "title", order: "desc", offset: 100]) ``` ```groovy results = Book.findAllByTitleAndAuthor("The Sum of All Fears", "Tom Clancy") ``` ```groovy results = Book.findAllByReleaseDateBetween(firstDate, new Date()) ``` ```groovy results = Book.findAllByReleaseDateGreaterThanEquals(firstDate) ``` ```groovy results = Book.findAllByTitleLike("%Hobbit%") ``` ```groovy results = Book.findAllByTitleIlike("%Hobbit%") // ignore case ``` ```groovy results = Book.findAllByTitleNotEqual("Harry Potter") ``` ```groovy results = Book.findAllByReleaseDateIsNull() ``` ```groovy results = Book.findAllByReleaseDateIsNotNull() ``` ```groovy results = Book.findAllPaperbackByAuthor("Douglas Adams") ``` ```groovy results = Book.findAllNotPaperbackByAuthor("Douglas Adams") ``` ```groovy results = Book.findAllByAuthorInList(["Douglas Adams", "Hunter S. Thompson"]) ``` -------------------------------- ### Grails Controller Example Source: https://grails.apache.org/docs/2.5.5/ref/Tags/form.html An example controller for a Grails application that handles book listing and retrieval. This controller is used in conjunction with the form tag examples. ```groovy class Book { def list() { [books: Book.list(params)] } def show() { [book: Book.get(params.id)] } } ``` -------------------------------- ### Install Dependency with Explicit Group, Name, and Version Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/install-dependency.html Installs a dependency by explicitly providing the group, name, and version as separate arguments. ```bash grails install-dependency --group=mysql --name=mysql-connector-java --version=5.1.16 ``` -------------------------------- ### Grails Shell Example Prompt Source: https://grails.apache.org/docs/2.5.5/ref/Command%20Line/shell.html This is an example of the prompt you will see when the Grails shell is active. ```groovy Groovy Shell (1.8.0, JVM: 1.6.0_26) Type 'help' or 'h' for help. ----------------------------------- groovy:000> ``` -------------------------------- ### GORM Basic CRUD Example Source: https://grails.apache.org/docs/2.5.5/guide/GORM.html Demonstrates adding authors to a book and saving the changes using GORM's dynamic methods. ```groovy def book = Book.findByTitle("Groovy in Action") book .addToAuthors(name:"Dierk Koenig") .addToAuthors(name:"Guillaume LaForge") .save() ``` -------------------------------- ### Example Decorated Page Structure Source: https://grails.apache.org/docs/2.5.5/ref/Tags/layoutBody.html This is an example of a page that will be decorated by a layout. It includes head elements and the body content. ```html