Creating a web app with Maven and Eclipse

In this example I'll show you how to quickly set up a web app project in Eclipse and build that project using Maven. We'll use this project later to show some simple examples of Unit and Component testing for web apps.

I'm going to assume that you've used Eclipse before. If not, the eclipse website is a good place to start. Eclipse is probably the most common Java IDE available. It supports a wide range of features and add-ons, including Maven. Before we start let's just install a Maven add-on to eclipse.

Installing Maven Integration for Eclipse

Creating a Maven Webapp Project

It's surprisingly easy to create a web app with eclipse and maven:

Image: Creating a web app with Maven and eclipse

And that's it! Maven and eclipse have created you a simple "Hello World" webapp with code in the most suitable places for a Maven project. In other articles we'll have a go at building this project, running it and add some automated testing too.