Basic Environment Concepts

From Coder's Log

Jump to: navigation, search

Contents

Intro

Having a build and deployment environment properly configured can save countless hours of managing deployments during and post developement. Any environment should be self sufficient as much as possible. Asside from the basic build support tools all external Jars should be available within the source control. In most situations versions of libraries tend to vary from one project to the next, just because you are currently working on Project B which uses Hibernate 3.0, you should not have to upgrade Project A's Hibernate 2.0 to do a small bug fix. The other benefit is when deploying to a test/production environment having a fully self sufficient build environment decreases the chances of something going wrong.

Folder Structure

Folder structure is something that tends to be very personal to the developer much like their .bashrc scripts. The structure I propose is fairly simple and not without its limitations. Its mainly targeted towards one module per projects approach, and is geared towards web based applications.

Project Root 
 +--src
 +--junit-src
 +--templates
 +--+--freemarker 
 +--+--jsps
 +--+--velocity
 +--lib
 +--build
 +--tomcat
 +--site
 +--+--junit-reports
 +--+--javadocs
 +--+--coverage-reports

Why Keep Tomcat in the Build Environment?

While having Tomcat in the build environment tends to increase each projects required space, it also creates a few interesting possibilities

  1. Projects can use different versions of Tomcat.
  2. Configuring a new web server is a simple as `cvs co module.`
  3. During development an IDE can be set to compile files directly into the web-inf/classes folder, and Tomcat can now be started independantly of the actual IDE while still supporting live redeployments, making the development smoother and much more like production.

Building and Deploying

Building and deploying should be as simple as typing ant build and ant deploy respectively. In multi environment configurations it is a good idea to configure the build scripts such that they take and additional parameter environment such that ant deploy -Denvironment=production will deploy the system to production.

Personal tools