Java web application modules

This type of module defines one Java web application. It contains all Java sources (for the servlets, e.g.), web content (JSPs and HTML, e.g.) and resources that are needed for the web application.

This type of module is typically build, tested and packaged into a .war (Web ARchive) file.

Layout

SourceBuildPackageDescription
src/javabuild/WEB-INF/classes/WEB-INF/classes Contains all java source files needed for the web application. Typically, these will be Servlet classes, action classes, etc.

When packaged, the built classes end up in the WEB-INF/classes directory of the .war file, which is on the classpath of a web application.
src/resources-/WEB-INF/classes The resources needed when testing and running the web application. These resources are on the classpath when running the unit tests. They end up in the WEB-INF/classes directory of the .war file, which puts them in the runtime classpath as well.
test/javatest- Contains the unit tests for the Java sources in this module. There is no limitation on the class name of the unit tests. All classes in this directory are supposed to be unit tests.

During the test step the compiled tests end up in the test directory of the module's Karma build directory.

The unit test classes are not packaged into the .war file.
test/resources-- Contains resources used by the unit tests. The files in this directory are placed on the classpath when running the unit tests.
src/web-/ Contains the web content of the web application that needs to be reacheable from the outside (by clients).

Typically, this content will be HTML files, images and JSP files.

The content of this directory is put in the root of the .war file.
src/web/WEB-INF-/WEB-INF This directory contains all web content that is not meant to be called from outside the application.

Typically, this content will be HTML files, images and JSP files.

One special files is the web.xml file, which is the descriptor of the web application. This file needs to be present.
<module dependencies>-/WEB-INF/lib Module dependencies are used during building and testing. They are put on the classpath at that time.

Module dependencies of which the attribute package equals true, are packaged into the .war file. They are placed in the WEB-INF/lib directory.
<jar dependencies>-/WEB-INF/lib Jar dependencies are used during building and testing. They are put on the classpath at that time.

Jar dependencies of which the attribute package equals true, are packaged into the .war file. They are placed in the WEB-INF/lib directory.