Specifying an External Library Location Using Build Path Variable

You can use variables (aliases) to specify an external library location in project build path to build a project using TIBCO BusinessEvents Studio. You can store the third-party JARs, custom function JARs, and .projlib files in different locations on your local machines and refer to them through aliases. To perform common builds on a build machine, the aliases are used to create the full path to common JAR files.

Procedure

  1. Open the project in TIBCO BusinessEvents Studio.
  2. In BusinessEvents Studio Explorer, right-click the project and click Properties (or press Alt-Enter).
    You see the Properties dialog box for the project.
  3. In the left panel, select Build Path and select the tab for which you want to new build path variable.
  4. Click Add Variable.
    The New Variable Classpath Entry window is opened.
  5. Click Configure Variables.
    The Preferences window is displayed to add a new variable.
  6. Click Add.
    The New Variable Entry window is displayed.
  7. In the Name field, enter the new variable name (for example, CUSTOM_HOME).
  8. In the Path field either select the JAR file or folder which contains all the dependent JAR files and click OK three times.
    The new variable is now added to the build path.

Result

The variable is used as a placeholder in the build path. These custom variables are saved in the .beproject file of the project. For example, the following entry is added for the EmsJars variable for third-party JAR files:
<thirdpartyLibEntries entryType="Third Party" path="EmsJars/jms.jar" timestamp="1327712526000" var="true">
<nativeLibraryLocation/>
</thirdpartyLibEntries>
The value var="true" specifies that the first part of the path is resolved as a configured variable. Other users can also use the same .beproject file, but they must create the variable that is being used if it does not already exist.

Define the value of that variable on your local machine (for example, C:\dev\mycustomjars\), and similarly define the value on the build machine. Thus, there are no hard-coded paths to the custom function, third-party JAR files, or project library entries, but only the relative ones.

The two methods using which you can specify where to find the JAR files during deploy time are:
  • Using classpath (-cp) option - In the command-line specify the path of the JAR files in the -cp command line option for the classpath. For example:
    studio-tools.exe -cp c:\logs\677138\cf-logger51.jar -core buildEar -o c:\temp\hello.ear -p C:\Logs\677138\HelloWorld_with_CustomFunction
  • Using the studio-tools.tra file - In the studio-tools.tra file, which is used to build the EAR file on the build machine, add the following property for each defined variable:
     java.property.CUSTOM_HOME=C:/Logs/677138/

    where, CUSTOM_HOME is the name of the variable.

    Now you can build EAR without specifying classpath in the command, for example:
    studio-tools.exe -core buildEar -o c:\temp\hello.ear -p C:\Logs\677138\HelloWorld_with_CustomFunction
    Note: Do not put the name of the JAR file at the end when specifying the value of the property. In the studio-tools.tra path, forward slashes are used.