With Maven you can create Vaadin project with vaadin-archetype-application
archetype. You can also add that archetype in IDE to create maven project with IDE.
mvn archetype:generate
-DarchetypeGroupId=com.vaadin
-DarchetypeArtifactId=vaadin-archetype-application
-DarchetypeVersion=7.6.8
-DgroupId=myvaadin.project
-DartifactId=DemoVaadinProject
-Dversion=0.1
-Dpackaging=war
Once you execute above command you will have following project structure.
DemoVaadinProject
|-src
|-main
|-java
| |-myvaadin
| |-project
| |-MyUI.java
|-resource
| |-myvaadin
| |-project
| |-MyAppWidgetset.gwt.xml
|-webapps
|- VAADIN
|-theme
|- mytheme.scss
|- addons.scss
|- styles.scss
|- favicon.ico
The created default maven project can be imported in IDE directly. To run the maven application we must compile the default widget sets of vaadin.
Note that we can directly use following maven command to package vaadin application and it will compile the widgetsets by default. You can use maven jetty plugin to deploy the vaadin application on Jetty.
cd path/to/DemoVaadinProject
mvn package jetty:run
This will deploy default application and start running it on default port 8080
. You can access the deployed application at http://localhost:8080.
It is ready to run without any changes. By default Vaadin archetype adds default theme, widgetset xml and MyUI
class which is an entry point for vaadin application.
In browser we will see following form.