Vaadin 8 on Grails 3
  • Introduction
  • Project setup
    • Environment setup
      • Unix based systems
      • Windows
    • Creating Project
      • Command line
      • IntelliJ IDEA
    • Plugin Configuration
      • UI class
      • URL mapping
      • Production mode
      • Async support
      • Themes
      • SASS compilation
      • Widgetset compilation
      • Servlet class
      • Spring component scan
      • UI provider
      • Open session in view
    • Clean up
    • Best Practices
  • Database
    • GORM
      • Create Domain Model
      • Transactions
      • LazyInitializationException
      • Open Session In View I.
      • Open Session In View II.
      • Table Container
    • Groovy SQL
      • Create Sql Bean
      • Execute SQLs
    • MyBatis
      • MyBatis Configuration
      • Reading Data with MyBatis
    • JdbcTemplate
      • Create JdbcTemplate Beans
      • Using JdbcTemplate
    • Clean Up When Using Alternatives
  • UI
Powered by GitBook
On this page
  • Create application
  • Step 1
  • Step 2
  • Step 3
  • Step 4
  • Step 5
  • Step 6

Was this helpful?

  1. Project setup
  2. Creating Project

Command line

PreviousCreating ProjectNextIntelliJ IDEA

Last updated 5 years ago

Was this helpful?

Source code for this tutorial is available on .

Using to create a new application is probably the most reliable way. We can basically say that if you are not able to create project using the command line, you will be not able to work with Grails at all and you need to re-install Grails or fix its configuration.

Create application

Follow these steps and run the commands in your terminal.

Step 1

Open your console or terminal and run grails create-app hello-world that will create new directory called hello-world with a sample Grails application.

Step 2

Go to that directory cd hello-world and open that folder in a text editor of your choice.

Step 3

Open build.gradle and add latest version of .

buildscript {
    repositories {
        //...
        maven { url 'https://dl.bintray.com/ondrej-kvasnovsky/plugins/' }
    }
    dependencies {
        classpath 'com.vaadinongrails:vaadin-gradle-plugin:2.0.2'
        // ... 
    }
}

Then apply com.vaadinongrails.vaadin-gradle-plugin (in section where other plugins are applied).

apply plugin: 'com.vaadinongrails.vaadin-gradle-plugin'

Now we need to add repository for grails-vaadin-plugin.

repositories {
    // ...
    maven { url 'https://dl.bintray.com/ondrej-kvasnovsky/plugins' }
}

Now we can add dependency to grails-vaadin-plugin. Do not forget to exclude vaadin-client-compiler because then we won't be able to start up the application because of library version collision.

dependencies {
    compile ('com.vaadinongrails:grails-vaadin-plugin:2.0.3') {
        exclude group: 'com.vaadin', module: 'vaadin-client-compiler'
    }
}

Step 4

We can create all the files manually or we can use gradle vaadin-quickstart command. That command generates sample application for us and that is what we are going to use in this tutorial.

Step 5

We need to prevent Grails to take over URL mapping. Open UrlMappings.groovy and make sure the URL mapping is empty.

class UrlMappings {
    static mappings = {
    }
}

Step 6

Here is how output in the console should look like.

> grails run-app
| Running application...
Grails application running at http://localhost:8080 in environment: development

We are ready to start up the application. Run grails run-app command. Vaadin application running on will become accessible in couple of seconds.

github.com/vaadin-on-grails-3/hello-world-cmd
Grails command line
vaadin plugin
http://localhost:8080
Generated Vaadin files
Generated Vaadin sample code