Starting Maven web project in Eclipse

We will create new web application project using Maven archetype and configure it for usage in Eclipse. Apache Maven must be installed and path to mvn command available in system variable PATH.

Generate Maven web application project

Run the following console command in parent directory of our new project:

mvn archetype:generate -DgroupId=com.example -DartifactId=formio-getstarted \ 
-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

To import the project into Eclipse IDE, you can run command:

mvn eclipse:eclipse

in newly created formio-getstarted project directory. In Eclipse, choose File - Import... - General - Existing Projects into Workspace - select your formio-getstarted directory.

The following pom.xml is generated:

<project xmlns="" xmlns:xsi=""
  <name>formio-getstarted Maven Webapp</name>

Settings for Eclipse

In Eclipse, set these properties of the project:

  1. Properties on the project - Project Facets - Convert to faceted form... - check the Dynamic Web Module facet, choose version 3.0 and click "Further configuration available..."
  2. In the Content Directory field, type "/src/main/webapp". Check "Generate web.xml deployment descriptor" and click OK.
  3. Properties - Java Compiler - check Enable project specific settings - set Compiler compliance level to 1.7, check that appropriate Java version is selected also in Java Build Path - Libraries - JRE...
  4. Click Apply, then click OK.

Web application descriptor web.xml must conform to choosen Servlet 3.0 version - if this is still not true, replace its content with:

    <display-name>Formio Getting Started</display-name>

Add desired version of servlet API to pom.xml:


Run Maven - Disable Maven Nature in Eclipse, remove possible kind="var" dependencies from .classpath file, run mvn clean:eclipse in command line and then in Eclipse in the project context menu: Configure - Convert to Maven Project to overcome possible "Maven generated archetype versus Eclipse" integration problems. "Maven Dependencies" Classpath Container should now occur in Package Explorer and should contain dependencies of the project.

When you add new dependency to pom.xml (and save the file), new dependency should automatically occur in classpath - in Maven Dependencies Classpath Container.

We must configure appropriate deployment of Maven dependencies: In project Properties - Deployment Assembly - Click Add... - Java Build Path Entries - Maven Dependencies to extract dependencies to WEB-INF/lib directory when the application is deployed. In Properties - Java Build Path - Order and Export - check Maven Dependencies.

Configuring server

Now we can configure runtime environment (servlet container) for our web application: Under Properties - Targeted Runtimes - choose and configure Apache Tomcat 7.0. Basic configuration will be sufficient. You will need to download and extract Apache Tomcat 7 binary distribution to some directory if you have not any server available yet. Select runtime and click OK, new Apache Tomcat classpath container should occur in the project.