Design > Source Code Organization and Build System
TODO: Answer the questions below to help you define your source code
organization and build process. Some example text is provided. Add
or delete text as needed. E.g., not all projects try to be platform
- What are the most important facts that a developer should know
about this source code organization and build system?
- It roughly follows the standard proposed in the Tomcat documentation and
is very similar to the organization used on many open source
projects at the Apache Software Foundation.
- What are the ranked goals of this source code organization and build system?
- Separation of files by type
- Separation of version-controlled files from files generated by
the build process
- Compatibility with standard build processes
- Platform independence
Key Directories and Files in Developer Working Copies
TODO: Describe the purpose of each directory that will appear in a
developer's work copy, also include any files that are important to
the overall structure or build process.
||Build properties file
||Java source code
||Java source code of classes in each package
||Java source code of unit tests for classes in each package
||HTML and JSP files
||CSS files, if any
||Image files, if any
||Java web application configuration file
||Configuration files, if any
||Initial data to load into database and/or file system, if any
||Libraries reused by this project, if any
||Command-line utility scripts used by this project, if any
||Project documents (e.g., overview, plan, requirements, and design)
||Output of build process
||Compiled code output by build process
||API documentation output from build process
||Deployable web archive of classes and config files generated by build process
TODO: Describe the build targets that developers will use in daily
development. The examples below should fit most projects.
|compile = default
||Compiles Java source code and creates .class
files under the "build" directory.
||Packages the system for distribution/deployment to servers
or end users. Specifically, it creates .war archive of compiled
classes and configuration files.
||Places executable code into location where it will actually be
executed. Specifically, it copies .war file into Tomcat's
webapps directory for use. You must then restart Tomcat or use
the "reload" link in the Tomcat Manager.
||Generates Java API documentation under "build/docs/api/".
||Deletes files generated by previous build commands.
Files under version control are not touched.
Build Configuration Options
||The name of this application. This should be one short word. Used
in the name of resulting package files. Specifically, the .war
file. And, it will be used to access the application via
||Version number of this release. Used in the name of
resulting package files. Specifically, the .war file.
||Path to the Tomcat "webapps" directory. Defaults
to C:\Program Files\Apache Group\Tomcat 4.1\webapps\
These build system properties can be modified by editing the
Source Code Organization and Build System Checklist
- Separation of files by type: Are files separated by type?
- Yes. Except that application JSP and HTML files are in the same
directory, which is convenient because sometimes we change an HTML
file to be a JSP file.
- Separation of version-controlled and non-version controlled
files: To what extent has this been achieved?
- It has been achieved. Everything is under version control
except for the "build" directory. No step in the build process
should create or modify any file in any other directory.
- Compatibility with standard build processes: To what extent has
this been achieved?
- So far, so good. We can use build.xml files that are very close
to the examples that come with Ant. One difference is that we keep
our technical documentation under "www" rather than under
"docs". Also, we have avoided the use of custom ant tasks.
- Platform independence: To what extent has
this been achieved?
- We are using Ant, which is itself platform independent. The
names of the files and directories should work across platforms
because they do not rely on case-sensitive names. We assume that
the utility scripts in the "scripts" directory support all needed
platforms and we have not created directories for different versions
of these files aimed at specific platforms.
- Have these implementation decisions been communicated to the
development team and other stakeholders?
- Yes, everyone understands. Feedback is
- No, this is a risk that is noted in the Risk Management section.
TODO: Check for words
of wisdom and discuss ways to improve this template.
Or, evaluate the ReadySET Pro professional source code organization template.