Setting up your projects

You verify that your projects have the right structure and you write one Project Object Model (POM) file per deployment configuration in a decision service. 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, and the XOM projects that correspond to it.
  • 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 there is more than one deployment configuration, 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.
  • resolvers: Specify Maven dependencies and rule project dependencies. Rule projects must reference a XOM project, which is a Java project that you reference as a Maven dependency. The values that you specify for this parameter correspond to the values in the entries of the .ruleproject file of your project. You do not need to specify a resolver for the JRE entry. You can specify more than one resolver. The kind parameter is required only if it is specified in the corresponding entry in the .ruleproject file. The value of the artifactKey parameter corresponds to the groupId and artifactId values defined in the dependency with the XOM project.
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>

  <resolvers>
    <resolver>
      <kind>JAVA_PROJECT</kind>
      <url>platform:/simple XOM</url>
      <artifactKey>${project.groupId}:simple-xom</artifactKey>
    </resolver>
  </resolvers>

</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 three 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:
  • simple BOM: Contains the BOM used by the main rule project.
  • simple Main: Contains the main decision service project, which is composed of a deployment configuration and decision operations, rules, and a POM file.
  • simple 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 simple Main folder specifies the deployments and resolvers parameters in the configuration section of the build property.

The POM file in the simple 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.