Versions Compared

Key

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

...

This project is ready to use as a template or a platform for experimentation with package imports, Java code execution, etc.

Anatomy of the Project

Directories

The directory into which the project was checked-out will be called the "base" directory. By default, it will be called "Example Maven Project".

This directory should contain two subdirectories.

No Format

src
test

The src dir is the root area for Java source code. (All the code for your project should be placed someplace under src.)

The test dir contains unit tests that use the JUnit testing framework.

Maven Build Files

The ExampleMavenProject module contains the following essential Maven files and directories, all of which should be included in a new Maven project.

No Format
build.sh
maven.xml
project.properties
project.xml
src
test

build.sh is a helper script for building the project with a set of maven commands.

...

The project.properties file is used to set named variables (properties) that determine certain project behavior, such as whether deprecation warnings are shown or the tests are skipped. You can put any custom maven settings into this file.

For instance, to show Java deprecation messages when compiling, remove the "#" from in front of this line in the project.properties file.

No Format

#maven.compile.deprecation=on

The project.xml file is the primary Maven configuration file that lists all the project's meta-information and its dependencies.

The src dir contains Java source files.

The test directory contains unit tests that use the JUnit testing framework.

There are two additional test files.

...

The file test/ExampleMavenProjectTest.java is a very basic test case templateexample that runs the main of a project class with some dummy arguments.

Building

To build the project from the command-line on Linux, Cygwin, etc.

...