Java - Project Directory Structure

> Procedural Languages > Java

1 - About

All jakarta projects follow a roughly similar Project Directory Structure.

The project contains sub directories

  • bin: common binaries, scripts - put this on the path.
  • build: This is the tree for building; Ant creates it and can empty it in the 'clean' project.
  • dist: Distribution outputs go in here; the directory is created in Ant and clean empties it out
  • doc: Hand crafted documentation
  • lib: Imported Java libraries go in to this directory
  • src: source goes in under this tree in a hierarchy which matches the package names. The dependency rules of <javac> requires this.

The bin, lib, doc and src directories should be under source code control.

An extra tree of content to be included in the distribution jars (inf files, images, etc.) can go under source too, with:

  • a metadata directory for web.xml and similar manifests,
  • and a web folder for web content - JSP, html, images and so on.

Keeping the content in this folder (or sub hierarchy) together makes it easier to test links before deployment. The actual production of a deployment image, such as a war file, can be left to the appropriate Ant task: there is no need to completely model your source tree upon the deployment hierarchy.

Javadoc output can be directed to a doc/ folder beneath build/, or to doc/javadoc.

2 - Documentation / Reference

Advertising
lang/java/directory.txt · Last modified: 2018/09/02 11:37 by gerardnico