Social Icons

Steps to create Maven based Dynamic Web Project in Eclipse

Well, something today absolutely from the basics. Many times newbies wonder how to create maven based Dynamic Web Projects on eclipse. So, this article is in rescue for all such developers.

Assuming you've already setup Maven and Tomcat / Pivotal tc with your eclipse, let's move ahead.


Step.1

Create a Simple Maven project in Eclipse

Step. 2
Select workspace location and select "Next"

Step. 3
Select Archetype with Artifact Id as "maven-archetype-webapp" and click "Next"

Step. 4
Enter your "Group Id", "Artifact Id" for your project and click "Finish"

Step. 5
If you observe some error markers on your project with the following error:

Then, either add the Tomcat / Pivotal tc server runtime to your project properties

Or, Add the following dependency on your "pom.xml" file
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>

Step. 7
Now goto Run As -> Maven build... menu

On the Run configurations window, enter Goals as "clean install" and click "Run"

If the setup is correct the build should complete successfully

Step. 8
Now let's run our project on Tomcat / Pivotal tc Server

You should be able to see you webapp running at:
http://localhost:8080/testwebproject


Your final project structure should like similar to:

Hope this helps you in creating you great maven projects henceforth...

0 comments:

Post a Comment