Create Maven Web Project using Eclipse

Step # 1

In the Eclipse IDE, navigate to File > New > Other… in order to bring up the project creation wizard.

Step # 2

Scroll to the Maven folder, open it, and choose Maven Project. Then choose Next.

Step # 3

You should choose to Create a project . This will create a Maven-enabled Java project. click Next.


Step # 4

Select Catalog Internal and enter 'Web'  in Filter textbox.  Choose maven-archetype-webapp Artifact ID and click Next button.


Step # 5

Enter your Project Name in Group ID and Artifact ID.  Enter your base package name  in Package Text field and click Finish button.  It will create your project.


Step # 6

You will now notice that your project has been created. You will place your Java code in/src/main/java, resources in /src/main/resources, and your JSP, HTML and  web contents in /src/main/webapp respectively.



Step # 7

Open the pom.xml file to view the structure Maven has set up. In this file, you can see the information entered in Step # 5.   You can add Servlet dependencies using following tag in pom.xml.

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        ....
    </dependencies>


Comments