Setting up your projects

You verify that your projects have the right structure and you write one Project Object Model (POM) file for each project that contains one or more deployment configurations. Each deployment configuration defines the RuleApp to build. POM files are XML files that contain the configuration details of your projects. They are used by the Build Command Maven plugin to build projects into RuleApps.

Writing POM files

There are three types of POM files:
  • XOM POM: If the Java project that defines your XOM is not already a Maven project, you must write the corresponding POM.
  • Decision service POM: You reference the deployment configuration of the decision service project.
  • Aggregator POM: If you have more than one POM, or if you want to separate the lifecycle of your decision service project from the lifecycle of your XOM project, you must reference the other POM files in this one.
You must write one decision service POM file for each decision service project. It should contain the following XML parameters that are used by the Maven plugin:
  • ruleModelExtension: If the project is using model extensions, you use this parameter to specify the path to the model and data files.
  • deployments: Specify the name of the deployment configurations. This name is specified in the name tags in the deployment configuration file and can be different from the name of the file in your file system. You can indicate that you want to embed the XOM in the RuleApp by using the embeddedXom parameter. If the XOM is a managed Java XOM, you must embed it in the RuleApp, otherwise this parameter is optional. The embedded XOM is deactivated by default. If you want to specify more than one deployment configuration in the same POM file, each additional configuration must have a classifier, and the names of the configurations must be different. When you specify a classifier, its value is suffixed to the name of the corresponding RuleApp file.
  • bomExtensionProperties: If the project is using BOM extensions, you must write a properties file and reference it from the decision service project POM file, and you must include the .jar file that contains the mappings of the extension classes in your project files.
    The properties file that you write must contain the following properties:
    • buildcommand.compileTimeLibraryPaths: Indicate the paths to the .jar files that contain the mappings. These paths are relative to the properties file in which you write them. If there is more than one .jar file, you must separate the paths with a comma (,).
    • buildcommand.info.<extension_key>: If the value info extension classes that are used in the build are different from the ones defined in the BOM, indicate the paths to the value info extension classes of the .jar files used in the build. <extension_key> must be the fully qualified name of the corresponding classes used in the BOM.
    For example, the properties file could contain the following values:
    buildcommand.compileTimeLibraryPaths = ProductsPlugin_1.0.0.201704061625.jar
    buildcommand.info.extensionClass = test.ProductValueInfo
The following example shows all the possible XML tags that you can use in the configuration part of a decision service project POM file:
<configuration>

  <ruleModelExtension>
    <model>resources/test-extension.brmx</model>
    <data>resources/test-extension.brdx</data>
  </ruleModelExtension>

  <deployments>
    <deployment>
      <name>simple deployment</name>
    </deployment>
    <deployment>
      <name>simple deployment 2</name>
      <embeddedXom>true</embeddedXom>
      <classifier>with-xom</classifier>
    </deployment>
  </deployments>

  <bomExtensionProperties>../bomExtensions.properties</bomExtensionProperties>

</configuration>
In order to build a RuleApp, you must also specify the packaging by adding the following parameter before the build section of this POM file:
<packaging>decisionservice</packaging>
Note: The POM files that you write in this context are tailored to the Build Command and cannot be imported as Maven files into Eclipse.

Project structure

You can build Java and rule projects. The folders that compose each project must be at the same level in your file system. For instance, if you have a main decision service and a BOM project, the content of your project folder should look like the following:
  • pom.xml file (aggregator POM)
  • BOM project folder
    • BOM subfolder
  • decision service project folder
    • deployment folder
    • pom.xml file (decision service POM)
    • rules folder
  • XOM folder
    • pom.xml file (XOM POM)
    • src folder

Examples

The Build Command installation files contain sample projects in <InstallDir>/buildcommand/samples/. Each project contains POM files with inline comments that explain the content of the parameters. If you want to edit these samples, you can copy and paste them in a separate working directory, so that you can easily access the original version of the files later.

The HelloWorld project is an example of a simple project that has one deployment configuration. It contains the following folders and file:
  • Hello BOM: Contains the BOM used by the main rule project.
  • Hello Main Service: Contains the main decision service project, which is composed of a deployment configuration and decision operations, rules, and a POM file.
  • Hello XOM: Contains the source files for the executable object model and a POM file.
  • pom.xml: References the projects to build.

The aggregator POM file at the root of the project specifies the version numbers of the XOM and the project, and references the decision service project and XOM project as modules. It also references the Build Command plugin.

The decision service POM file in the Hello Main Service folder specifies the deployments parameters in the configuration section of the build property.

The POM file in the Hello XOM folder describes how to build this project as a Java project.

The LoanValidation project is an example of a project that contains two deployment configurations. These configurations are referenced in the decision service POM file.

The CustomRuleModel project is an example of a project that contains rule model extensions. The model and data files for the extensions are referenced in the decision service POM file.

The RuleAwareOfContext project is an example of a project that contains rule model extensions and BOM extensions. The BOM extensions properties file is referenced in the decision service POM file, and the extension classes are available in the ilog.rules.studio.samples.ruleawareofcontext folder.