How to create a web project using Maven in Eclipse

In this tutorial, we provide a step-by-step guide on how to create a web project using Maven in Eclipse.

Prerequisites:

  • Eclipse IDE (Mars release)
  • Java 1.8
  • Apache tomcat 8

1. Step-1

Open eclipse, then select File -> New -> Maven Project.

New Project Maven

2. Step-2

In the next screen, select the workspace of the project and keep the other options as default then click “Next”:

New Maven Project

3. Step-3

In the following screen, select “maven-archetype-webapp” then click “Next”:

Maven Web Archetype

4. Step-4

In the final screen, fill the mandatory fields as the following:

Maven Artificat Id

  • “Group Id”:  denotes a unique “dot” separated group name, which is used by external projects that link to yours, this field is normally set as the company name.
  • “Artifact Id”: denotes the name of the web project.
  • The main package of the project is the concatenation of “Group Id” + “Artifact Id”

Click “Finish”.

5. Step-5

Eclipse now generates a dynamic web project called “SimpleWebProject”, in case you face this error inside index.jsp:

then just add the following dependency to pom.xml:

6. Step-6

In order to compile your project with Java 8, add the following property to pom.xml:

then right click project -> Maven -> Update Project

7. Step-7

Here we go, the structure of the generated project looks like the following:

Maven Web Project

8. Step-8

Finally deploy the web application on Tomcat, if you haven’t setup Tomcat in your eclipse, then follow this guide.

After the deployment, you would be able to access index.jsp through the following url:

localhost:<PORT_NUMBER>/SimpleWebProject/index.jsp

That’s it.

Hussein Terek

Founder of programmergate.com, I have a passion in software engineering and everything related to java environment.

You may also like...

10
Leave a Reply

avatar
10 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
바카라사이트바카라사이트추천카지노무료머니카지노사이트추천인터넷바카라 Recent comment authors
newest oldest most voted
Navin Kumar
Guest
Navin Kumar

Hi I am a new in Maven and trying to create a new maven project but facing the issue after above all steps.I am writing the issue bellow.
org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject,
org.apache.maven.archiver.MavenArchiveConfiguration)
please provide the sulution.

version is 0.0.1-shnapshot.

Thanks and Regards,
Navin Kumar,

vivek
Guest
vivek

why we are getting errors when we are importing maven project without commands i.e. File -> Existing Maven Project

vivek
Guest
vivek

What are the Maven Commands for console

Vidya Sagar Panati
Guest
Vidya Sagar Panati

Thank you for this detailed tutorial.

Michealgap
Guest
Michealgap

Hi, here on the forum guys advised a cool Dating site, be sure to register – you will not REGRET it https://bit.ly/39Zx5oK

인터넷바카라
Guest
인터넷바카라

learning is important because it will bring you good life so you do not have time to spend because it is so important that while you are just learning how to teach and I’ll teach you the right approach you have at my site
인터넷바카라

카지노사이트추천
Guest
카지노사이트추천

Great post – I use WPDiscuz myself. Users of CommentLuv need to find something new, so I’d recommend that one.
카지노사이트추천

카지노무료머니
Guest
카지노무료머니

Wonderful, what a blog it is! This web site gives useful facts to us, keep it up.
카지노무료머니

바카라사이트추천
Guest
바카라사이트추천

Great article. I really enjoyed the read and the logic.
바카라사이트추천

바카라사이트
Guest
바카라사이트

Great post. I was checking constantly this blog and I’m impressed! Extremely helpful information specifically the last part 🙂 I care for such info a lot. I was looking for this particular information for a long time. Thank you and good luck.
바카라사이트