reset password

Maven Web Application

Create a simple Maven project in Eclipse as shown in the screenshot below:

New Maven Project

On the next screen, fill out Group Id, Artifact Id, and change Packaging to war. You can leave all other fields as is.

After the project is created, add the following to pom.xml (inside <project> and after <packaging>):

  <build>
    <finalName>springmvc</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>3.0.1</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jstl</artifactId>
          <version>1.2</version>
      </dependency>
  </dependencies>

These changes specify that the project requires JDK 1.7 and add the following dependencies:

  • javax.servlet:javax.servlet-api:3.0.1
  • javax.servlet:jstl:1.2

Right click on the project and select Properties -> Project Facets, and change the version of Dynamic Web Module to 3.0 and Java to 1.7.

Right click on the project and select Maven -> Update Project...

This page has been viewed 20216 times.