Deploying and writing RuleApps by running Ant tasks

Whether your RuleApps originate from decision services or from classic rule projects, you can use Ant tasks to deploy RuleApp archives to a running Rule Execution Server instance and write the RuleApps to a file system or database.

About this task

You can use Ant tasks for some RuleApp management tasks. Here are a few common cases:
  • Use res-deploy to deploy a RuleApp.
  • Use res-write-file to add a RuleApp archive to a file system.
  • Use res-write-db to add a RuleApp archive to a database.

If the RuleApp is associated with a Java™ XOM, you can use the res-deploy-xom, res-write-xom-file, and res-write-xom-db Ant tasks in a similar way.

Attention:

When you deploy a RuleApp with a merging policy at the ruleset level, the RuleApp that already exists in the Rule Execution Server is updated with the deployed RuleApp (description, display name, properties). If you update this RuleApp from the Rule Execution Server console, all modifications are lost at the next deployment that applies a merging policy at the ruleset level.

Procedure

To manage RuleApps with Ant tasks, use the following commands:
  • To deploy a RuleApp, write the following code:
    <res-deploy 
       hostname="localhost" 
       portnumber="9080" 
       userid="resAdmin" 
       password="mypassword" 
       file="myruleapp.jar"/>

    See res-deploy for a description of the element attributes.

  • To add a RuleApp archive to a file system, write the following code:
    <res-write-file 
       dir="res_data" 
       file="myruleapp.jar" />

    See res-write-file for a description of the element attributes.

  • To add a RuleApp archive to a database, write the following code:
    <res-write-db driver="com.ibm.db2.jcc.DB2Driver" 
                   url="jdbc:db2://MYDB2Server:50000/MyIncance" 
                   userid="resusername" password="respassword" file="myruleapp.jar">
       <classpath>
          <pathelement location="db2jcc.jar"/>
          <pathelement location="db2jcc_license_cu.jar"/>
       </classpath>
    </res-write-db>

    See res-write-db for a description of the element attributes.