Guide to Decoupling Your Project

This guide discusses how to separate your build from the distribution.

It may be the case that you wish to leave the Tynamo™ distribution alone, and keep all your source and configuration files in a separate place. This is possible to do, and does not take much effort to accomplish.

The intended audience of this guide is those who have become moderately familiar with the Tynamo™ setup process.

Summary

In short, only the project source files, HTTP data, and configuration files need to be in your own project directory. When you set the basedir Ant property, you will have completely separated your project from the Tynamo™ distribution.


Steps

  1. First, create your own project directory. For example, create /Projects/coolserver. The disussion that follows will use this example.
  2. Next, create the following subdirectories:
    • src — This will contain your source files.
    • res — Web content and configuration files will go here.
    • output — This will contain the output from JemBuilder.
  3. Lastly, copy build.properties to the project directory.

[If you will be modifying the build.xml script then copy this file as well. In this case, make sure to change the deploy.root property inside the script to the location of the Tynamo™ distribution. To do this, replace the line that contains

<dirname property="distro.root" file="${ant.file}"/>

with a line that looks like

<property name="distro.root" value="/tynamo-ajile-1.0"/>

Be sure, also, to replace "/tynamo-ajile-1.0" with the actual location of the distribution.]


Project Location — How to Use Ant

The build.xml file, by default, executes from the distribution location. To override this, set the basedir property when starting Ant.

For example, say your project directory is located in /Projects/coolserver and your Tynamo™ distribution is located in /tynamo-ajile-1.0. The two ways of setting this as your base project directory are as follows:

  1. Change to /Projects/coolserver and execute:
    ant -Dbasedir=. -f /tynamo-ajile-1.0/build.xml
    OR:
  2. ant -Dbasedir=/Projects/coolserver -f /tynamo-ajile-1.0/build.xml

The second option is more explicit, and probably safer to use in the presence of many different projects and project files.

Note: Starting Ant this way is unnecessary if you have chosen to copy the build.xml file to your project directory.


Project Files

All your project files are arranged in the same way as the Tynamo™ distribution, just located in a different directory.

Source Files

Place all your source files into the src/ directory you have just created (or another location of your choosing), and set up the build.properties file to use this as the source files location. For example:

src.paths=src
src.files=com/mycompany/servlet/**/*.java

If the javac.destination property has not been changed in the build.xml script, then the source files will be compiled into a directory named classes/ underneath /Projects/coolserver. Be sure to use this location when setting up JVM0.Classpath in JemBuilder (see step 3 of the Build Using JemBuilder section in the tutorial).

Resources

All the configuration files and static content should reside in res/config/ and res/http-root/, respectively. You can set up the files by using the distribution as an example.

As with the compiled source files, use this project location when setting up JVM0.Classpath in JemBuilder.

Build Configuration

The build.properties file is set up as usual. Please consult the documentation for further details. The relevant documents include the Tutorial and Server Configuration.