---
title: Creating a Project with Maven
order: 200
layout: page
---

[[getting-started.maven]]
= Creating a Project with Maven

((("Maven", "creating a project", id="term.maven.creating", range="startofrange")))

In previous sections, we looked into creating a Vaadin Maven project in different IDEs.
In this section, we look how to create such a project on command-line.
You can then import such a project in your IDE.

In addition to regular Maven, you can use any Maven-compatible build or
dependency management system, such as Ivy or Gradle. For Gradle, see the
link:https://github.com/johndevs/gradle-vaadin-plugin[Gradle Vaadin Plugin].

For an interactive guide, see the instructions at link:https://vaadin.com/maven[vaadin.com/maven].
It automatically generates you the command to create a new project based on archetype selection.
It can also generate dependency declarations for Vaadin dependencies.

[[getting-started.maven.command-line]]
== Working from Command-Line

You can create a new Maven project with the following command (given in one
line):

[subs="normal"]
----
[prompt]#$# [command]#mvn# archetype:generate \
   -DarchetypeGroupId=com.vaadin \
   -DarchetypeArtifactId=[replaceable]#vaadin-archetype-application# \
   -DarchetypeVersion=[replaceable]#8.x.x# \
   -DgroupId=[replaceable]#com.pany# \
   -DartifactId=[replaceable]#project-name# \
   -Dversion=[replaceable]#0.1# \
   -Dpackaging=war
----
The parameters are as follows:

[parameter]#archetypeGroupId#:: The group ID of the archetype is [literal]#++com.vaadin++# for Vaadin
archetypes.

[parameter]#archetypeArtifactId#:: The archetype ID.
See the list of available archetypes in <<getting-started-archetypes#getting-started.archetypes,"Overview of Maven Archetypes">>.

[parameter]#archetypeVersion#::
Version of the archetype to use.
For prerelease versions it should be the exact version number, such as [literal]#++8.0.0.beta2++#.

[parameter]#groupId#:: A Maven group ID for your project. It is normally your organization domain name
in reverse order, such as com.example. The group ID is also used as a prefix for
the Java package in the sources, so it should be Java compatible - only
alphanumerics and an underscore.

[parameter]#artifactId#:: Identifier of the artifact, that is, your project. The identifier may contain
alphanumerics, minus, and underscore. It is appended to the group ID to obtain
the Java package name for the sources. For example, if the group ID is
com.example and artifact ID is myproject, the project sources would be placed in
com.example.myproject package.

[parameter]#version#:: Initial version number of your application. The number must obey the Maven
version numbering format.

[parameter]#packaging#:: How will the project be packaged. It is normally [literal]#++war++#.



Creating a project can take a while as Maven fetches all the dependencies.

[[getting-started.maven.compiling]]
== Compiling and Running the Application

((("Maven", "compiling", id="term.maven.compiling", range="startofrange")))


Before the application can be deployed, it must be compiled and packaged as a
WAR package. You can do this with the [literal]#++package++# goal as follows:

[subs="normal"]
----
[prompt]#$# [command]#mvn# package
----
The location of the resulting WAR package should be displayed in the command
output. You can then deploy it to your favorite application server.

The easiest way to run Vaadin applications with Maven is to use the light-weight Jetty web server.
After compiling the package, all you need to do is type:

[subs="normal"]
----
[prompt]#$# [command]#mvn# jetty:run
----

The special goal starts the Jetty server in port 8080 and deploys the
application. You can then open it in a web browser at
http://localhost:8080/project-name.

(((range="endofrange", startref="term.maven.compiling")))

[[getting-started.maven.addons]]
== Using Add-ons

((("Maven", "using add-ons", id="term.maven.addons", range="startofrange")))

If you use Vaadin add-ons from the http://vaadin.com/directory[Vaadin Directory], you need to add them as dependencies in the project POM.
The instructions are given in <<../addons/addons-maven#addons.maven, "Using Add-ons in a
Maven Project">>.

_In projects that use Vaadin 7.6 or older_, you need to compile the widget set manually.
See the add-on usage instructions.

(((range="endofrange", startref="term.maven.addons")))
(((range="endofrange", startref="term.maven.creating")))
>grid_dnd_autoscroller</option>
<option value='grid_dragger'>grid_dragger</option>
<option value='issue/8307_select_using_collection'>issue/8307_select_using_collection</option>
<option value='master'>master</option>
<option value='mobile_drag_image_offset'>mobile_drag_image_offset</option>
<option value='pr/11306'>pr/11306</option>
<option value='remote-run/flow-atmosphere-test'>remote-run/flow-atmosphere-test</option>
<option value='snapshot/7.5'>snapshot/7.5</option>
<option value='snapshot/7.6'>snapshot/7.6</option>
<option value='tmattsso-patch-1'>tmattsso-patch-1</option>
<option value='update-minor-deps'>update-minor-deps</option>
<option value='vaadin-icons-3.0.1'>vaadin-icons-3.0.1</option>
<option value='wip-date-time-datatype'>wip-date-time-datatype</option>
<option value='wip-java-10-compat'>wip-java-10-compat</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Vaadin 6, 7, 8 is a Java framework for modern Java web applications: https://github.com/vaadin/framework</td><td class='sub right'>www-data</td></tr></table>
<table class='tabs'><tr><td>
<a href='/vaadin-framework.git/?h=8.18.0'>summary</a><a href='/vaadin-framework.git/refs/?h=8.18.0'>refs</a><a href='/vaadin-framework.git/log/README.md?h=8.18.0'>log</a><a class='active' href='/vaadin-framework.git/tree/README.md?h=8.18.0'>tree</a><a href='/vaadin-framework.git/commit/README.md?h=8.18.0'>commit</a><a href='/vaadin-framework.git/diff/README.md?h=8.18.0'>diff</a><a href='/vaadin-framework.git/stats/README.md?h=8.18.0'>stats</a></td><td class='form'><form class='right' method='get' action='/vaadin-framework.git/log/README.md'>
<input type='hidden' name='h' value='8.18.0'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/vaadin-framework.git/tree/?h=8.18.0'>root</a>/<a href='/vaadin-framework.git/tree/README.md?h=8.18.0'>README.md</a></div><div class='content'>blob: aad509d2b4a63615d2456d58679e3a67abd3db37 (<a href='/vaadin-framework.git/plain/README.md?h=8.18.0'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<a id='n23' href='#n23'>23</a>
<a id='n24' href='#n24'>24</a>
<a id='n25' href='#n25'>25</a>
<a id='n26' href='#n26'>26</a>
<a id='n27' href='#n27'>27</a>
<a id='n28' href='#n28'>28</a>
<a id='n29' href='#n29'>29</a>
<a id='n30' href='#n30'>30</a>
<a id='n31' href='#n31'>31</a>
<a id='n32' href='#n32'>32</a>
<a id='n33' href='#n33'>33</a>
<a id='n34' href='#n34'>34</a>
<a id='n35' href='#n35'>35</a>
<a id='n36' href='#n36'>36</a>
<a id='n37' href='#n37'>37</a>
<a id='n38' href='#n38'>38</a>
</pre></td>
<td class='lines'><pre><code>