Command line
Source code for this tutorial is available on github.com/vaadin-on-grails-3/hello-world-cmd.
Using Grails command line 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 vaadin plugin.
Then apply com.vaadinongrails.vaadin-gradle-plugin
(in section where other plugins are applied).
Now we need to add repository for grails-vaadin-plugin
.
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.
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.
Step 6
We are ready to start up the application. Run grails run-app
command. Vaadin application running on http://localhost:8080 will become accessible in couple of seconds.
Here is how output in the console should look like.
Last updated
Was this helpful?