Maven 2: Building Web Projects

Printable Version

By default Maven 2 provides a standard way of building web applications. All of the web files such as web.xml and tag libraries and must be stored in “webapp” directory which is located under "src/main".

The project directories structure would look like this:

Maven 2 default file structure for web applications

While this is perfectly fine for the new applications for some existing projects this file structure might be inappropriate. Unfortunately some times you cannot change the existing file structure as you pleased. For example, if you use PVCS as your source control system, then you don’t want to change the existing file structure because it is very difficult to update the source repository.

Another issue that you might have is integration with development tools such as WSAD or My Eclipse IDE. By default they use different file structure for web projects and unless you want to take a way from people the ability to use debugger you better follow the same file structure as WSAD suggests.

Default WSAD file structure

To implement this we will have to modify our POM file and configure maven-war-plugin to tell it where to find web resources. You need to specify the path to the folder that contains the web content. This is how you configure the war plug-in

Developed by GARBUZ.COM © 1999-2007
Site information

GARBUZ.COM