Decision Management (ODM,ADS)

 View Only
  • 1.  Equivalent for the ant task 'res-write-file' in Build Command Maven plugin

    Posted Mon May 09, 2022 08:37 PM

    We are working on writing new build scripts from scratch using the Build Command Maven plugin to avoid the pain of updating the existing build agent and standup new build agents while upgrading the ODM platform.

    What is the equivalent for the ant task 'res-write-file' in maven?

    Suppose I unpack the ruleapp archive (produced using the maven plug-in) to the res_data folder to run Junit cases. In that case, Maven complains that it can't retrieve the information about the ruleset /XYZRuleApp/1.0/XYZRules/1.0 in the 'res_data' folder.

    I believe the issue is the issue of the unpacked RuleApp\1.0 and Ruleset\1.0 folders missing the below files. We get these files using the 'res-write-file' ant task.

    1) creation_date.txt

    2) properties.txt

    3) display_name.txt



    ------------------------------
    Charan Paladugu
    ------------------------------


  • 2.  RE: Equivalent for the ant task 'res-write-file' in Build Command Maven plugin

    Posted Wed May 11, 2022 09:15 PM

    When I use a decision deployment in the Rule Designer to deploy the RuleApp to a 'Local Rule Execution Server on Java SE' target server (res_data folder), the RuleApp/1.0 and Ruleset/1.0 folders contain the below mandatory files for the rules execution using j2serulesession. However, the RuleApp archive produced by the maven plugin for the same deployment doesn't include the below files.

    1) creation_date.txt

    2) properties.txt

    3) display_name.txt

    Isn't that a bug in the Build Command maven plugin? If not, why is there a difference in the created archives content?



    ------------------------------
    Charan Paladugu
    ------------------------------



  • 3.  RE: Equivalent for the ant task 'res-write-file' in Build Command Maven plugin

    Posted Thu May 12, 2022 09:08 AM
    Hello Charan,

    In the RuleApp archive, this information is stored into META-INF/archive.xml file.
    In maven, you can use the provided ANT task directly using the maven-antrun-plugin :
    <plugin>
      [...]
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-antrun-plugin</artifactId>
      <executions>
        <!-- Install ruleapps -->
        <execution>
          <id>install-ruleapps</id>
          <phase>generate-test-resources</phase>
          <configuration>
            <tasks>
              <taskdef name="res-write-file" classname="ilog.rules.res.tools.persistence.IlrWriteFileTask">
                <classpath refid="maven.runtime.classpath" />
              </taskdef>
              <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
                <classpath refid="maven.runtime.classpath" />
              </taskdef>
              <for param="file">
                <path>
                  <fileset dir="${ruleapps.download.dir}">
                    <include name="**/*.jar"/>
                  </fileset>
                </path>
                <sequential>
                  <echo>Installing ruleApp @{file}</echo>
                  <res-write-file
                    failonerror="true" dir="${ruleset.repository.path}"
                    file="@{file}"
                  mergingpolicy="REPLACE_MERGING_POLICY"/>
                </sequential>
              </for>
            </tasks>
          </configuration>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
        [...]
    </plugin>

    Hope this helps,

    Nicolas



    ------------------------------
    NICOLAS PEULVAST
    ------------------------------



  • 4.  RE: Equivalent for the ant task 'res-write-file' in Build Command Maven plugin

    Posted Sat May 14, 2022 10:15 PM
    Thank you, Nicolas. That did work!

    ------------------------------
    Charan Paladugu
    ------------------------------