Serious Java Web application development requires a lot of different applications. In addition to a JDK, an IDE and an application server you may need a Web application framework, a build system and some form of version control. Unsurprisingly, getting set up for development can be quite the task.
In this post we’ll take a look at setting up a Web application project from start to finish. The software we will use is:
What Are We Building?
Different applications come in different forms.
- A Windows application written in C++ may be compiled to a .exe file.
- Runnable Java GUI applications often come in a JAR (Java ARchive).
- Java Web applications are packaged in WAR and EAR files.
We are building a Web application, so the product of building our project will be a WAR file. The Glassfish application server extracts a WAR file and runs the application inside it. The WAR file also contains a deployment descriptor,
web.xml that describes how the application server should run the WAR.
The structure of a WAR file looks like this (source):
Project Setup with Maven Archetypes
Now that we know what we are building, it is time to start setting up the project. The directory/file structure…