The Vaadin core library and all Vaadin add-ons are available through a Maven repository and can thereby be easily used with Apache Maven. You can use a Maven with a front-end from Eclipse or NetBeans, or by using the command-line as described in this section.

You can create a new Maven project with the following command:

$ mvn archetype:generate
    -DarchetypeGroupId=com.vaadin
    -DarchetypeArtifactId=vaadin-archetype-clean
    -DarchetypeVersion=LATEST
    -DgroupId=your.company
    -DartifactId=project-name
    -Dversion=1.0
    -Dpackaging=war

The parameters are as follows:

archetypeGroupId

The group ID of the archetype is com.vaadin for Vaadin archetypes.

archetypeArtifactId

The archetype ID. Vaadin currently supports the following archetypes:

  • vaadin-archetype-clean is a new project with a barebone skeleton for a regular Vaadin application. The pom.xml includes out-commented definitions for additional widgets.
  • vaadin-archetype-widget is a skeleton for a project with custom widgets.
  • vaadin-archetype-addon is for Vaadin add-on projects. It packages the add-on so that it can be published in Vaadin Directory. The archetype is for server-side add-ons and does not include definitions needed for building a widget set. If your add-on includes or requires other than the widgets in the Vaadin core library, you need to copy the required definitions from a POM of a vaadin-archetype-clean project.
  • vaadin-archetype-touchkit is for projects using Vaadin TouchKit, described in Chapter 19, Mobile Applications with TouchKit. Notice that this archetype uses the AGPL-licensed version of TouchKit, which requires that your project must also be licensed under the AGPL license.
archetypeVersion

Version of the archetype to use. This should normally be LATEST.

groupId

A Maven group ID for your project. It is used for the Java package name and should normally be your domain name reversed, such as com.example.myproject. The group ID is used also for the Java source package name of your project, so it should be Java compatible - only alphanumerics and an underscore.

artifactId

Identifier of the artifact, that is, your project. The identifier may contain alphanumerics, minus, and underscore.

version

Initial version number of your application. The number must obey the Maven version numbering format.

packaging

How will the project be packaged. It is normally war.

Creating a project can take a while as Maven fetches all the dependencies. The created project structure is shown in Figure 2.8, “A New Vaadin Project with vaadin-archetype-clean.