Setting Up a Development Environment for Generated Files
Problem
You want to set up your development environment to handle generated files.
Solution
Create two
directories at the same level as
your source and build tree. The first directory contains generated
source code and may be called something like
src-generated
. The second directory contains
compiled code for the generated source and may be called something
like build-generated
.
Discussion
The best location for generated source files is in a directory at the same level as your source tree and build tree. Equally important is separating the compiled code for generated source files from the compiled code of nongenerated source files. This provides a convenient, easy to manage directory structure, as shown in Figure 9-1.
Figure 9-1. Directory structure for generated files
Why not place generated files in the source directory?
Placing generated files in the src
directory causes version control tools to assume new files should be
added to the repository, which is simply not true. Generated files
should never be versioned, but rather the templates and scripts that
are used to generate the files should be versioned.
DO NOT check generated files into your version control tool.
DO check the templates and scripts used to generate the files.
Why not place generated files in the build directory?
Placing generated files in the build
directory has ...
Get Java Extreme Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.