Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Directory

Description

src

All project source goes here.

|¦- main

The primary Primary source directory.

|¦  ¦- -- java

Java source code

|--¦  ¦  `- -- tutorial

Package defined by groupId parameter

|-------¦  ¦     `- example

The example actions from the archetype

|--¦  ¦- resources

Resources (config, property, and validation files, and so on

|-¦  ¦  `----tutorial

Package defined by groupId parameter

|-------¦  ¦     `- example

Example property and validation files from archetype

|--¦  `- webapp

Web application files (HTML, JSP, etc.)

|--¦      `- -- WEB-INF

Typical WEB-INF folder

|¦         `- ---- example

Files from archetype

|`- test

Test code (unit tests etc.)

|--     `- java

Java-based test code

|-        `- --- tutorial

Package defined by groupId parameter

           `- example

Test code from archetype

Structure Difference From Non-Maven Projects

One big change for folks not used to the Maven structure is the separation of Java source code and resource files. For example, in a non-Maven project our directory structure might look like this:

src

All project source

¦- tutorial

Tutorial package

¦  `- example

Example package

¦     ¦- Login.java

Login action source

¦     ¦- package.properties

Resource file

¦     `- Login-validation.xml

Validation file

`- struts.xml

Struts 2 config file

web

Web app files

¦- WEB-INF

Typical WEB-INF folder

`- index.html

An HTML file

It can take a little while to get used to, but ultimately it provides good separation of "types" of things, and becomes second-

...

nature pretty quickly. Note that it's possible to use a non-Maven directory layout with Maven projects, but this can be challenging at some points.