Introducing a new script

The following section details the steps to create a new top level script which can be used to introduce new targets, enhance existing targets or override OOTB build targets.

Two Environment variables CDEJ_BUILDFILE and SDEJ_BUILDFILE are used to control the script that is invoked by the build.bat or.sh files. A new script can be invoked by setting the appropriate environment variable. For example:

Introducing a new server script:

          SDEJ_BUILDFILE=%SERVER_DIR%/components/custom/scripts/build.xml

This script must then import it's parent in the hierarchy EJBServer\build.xml, for example:

<?xml version="1.0" encoding="UTF-8"?>
<project name="custom">

  <!--  Relative path to EJBServer\build.xml  -->
  <import file="./../../../../build.xml"/>

</project>

New targets can then be added to the script as required. These targets can also utilize existing targets or properties in the inherited script hierarchy.

To enhance or override an existing target the same target name is chosen as that which is being enhanced or overriden. When enhancing a target, the existing target is then either added as a dependency of the new target or invoked during a point in the new target. The previous target's name used is formed from the project name of the script where the target being enhanced exists. For example:

Figure 1. Before/After Target usage

Enhancing the database target, where the project name of the SDEJ script containing the database target is app_database.

Before target usage:

<target name="database" >
  <!-- Some further processing before the SDEJ database target -->
  ...
  <antcall target="app_database.database"/>
</target>

After target usage:

<target name="database" depends="app_database.database">
  <!-- Some further processing after the SDEJ database target -->
  ...
</target>
Target API: Only targets that are documented i.e. those visible through the -projecthelp for a script should be enhanced, overriden or invoked. Other targets are considered internal are subject to change without notice.