Add Xom to managed URI In res - jrules

I am Working on ILOG.Currently I am using an Ant script for deploying ruleapp to res.My Problem is when I am deploying it is working fine but I want to add xom automatically to " ADD Managed URI" tab present in res. xom is getting attached to ruleapp but i want to get it attached to managed uri section.
Thanks in advance.

Have you tried this way - Got it from IBM Help.I have not tried it, but looks like, it should work. ( IBM ODM.8.0.1)
<target name="deployruleappwithxom">
<res-deploy hostname="${hostname}" portnumber="${portnumber}" webapp="${webapp}" userid="${userid}" password="${password}" file="my-ruleapp.jar">
<xompath rulesetpath="/MyRuleApp/MyRuleset">
<fileset dir="${lib}">
<include name="**/myxom.jar" />
</fileset>
</xompath>
<xompath rulesetpath="/AnotherRuleApp/AnotherRuleset">
<fileset dir="${otherlib}">
<include name="**/otherxom.jar" />
</fileset>
</xompath>
</res-deploy>
</target>
if you just looking for managing xomuri property, you can try this.
<target name="runloanvalidation">
<res-deploy-xom
hostname="localhost"
portnumber="9080"
webapp="res"
userid="resAdmin"
password="resAdmin"
jarMajorVersion="false"
libName="person"
outputRulesetProperty="ruleset.managedxom.uris">
<xompath>
<fileset dir="hello">
<include name="*.jar"/>
</fileset>
</xompath>
</res-deploy-xom>
<echo message="Resulting property: ${ruleset.managedxom.uris}"/>
</target>
And for more information, you can visit this.
http://www-01.ibm.com/support/knowledgecenter/#!/SSQP76_8.6.0/com.ibm.odm.dserver.rules.ref.res/ant_tasks/con_ant_res_deploy_xom.html

Related

Ant can't seem to link to groovy properly in NetBeans 8.2

In netBeans 8.2, I'm having an issue reading groovy inside a build.xml file.
I have a project in which I run my script via a build.xml using the build-in Ant 1.9.7.
In it, for my groovy task, I set the following:
<property environment="env" />
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable" />
</path>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath" />
For environment variable {env.GROOVY_HOME}, I have set the following in windows environment variable:
GROOVY_HOME with the value C:\Program Files (x86)\Groovy\Groovy-2.4.10
Yet I'm still having an error ""Script failed" when reaching the step with Groovy at the following stage in the build.xml file:
<groovy>
def corePlatformList = []
[Groovy code here...]
</groovy>
I know the script is working fine as it does run perfectly in Eclipse and IntelliJ.
It would seem ant can't link with Groovy 2.4.10 for some reason.
I believe that you have some trivial error.
You need to include the library file.
Change from:
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable" />
</path>
To:
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable">
<include name="**/groovy-all-*.jar"/>
</fileset>
</path>
EDIT: based on OP comments
Here is the complete build.xml and I can see it working.
<project name="MyProject" default="runscript" basedir=".">
<path id="groovy.classpath">
<fileset dir="d:/softwares/groovy-2.4.5/embeddable">
<include name="**/groovy-all-*.jar"/>
</fileset>
</path>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath" />
<target name="runscript"
description="compile the source">
<groovy>
def corePlatformList = [1,2,3,4]
println corePlatformList
</groovy>
</target>
</project>

Ant search in text file some text expression

Ant search in text file some text expression, if it NOT found I try to delete file that txt was. So my code in Ant is down, but I don't know how put NOT correctly
<target name="ifDelete">
<if>
<length when="greater" length="0">
<fileset file="MyText.txt">
<!--containsregexp negate="true"-->
<containsregexp expression="findME" />
<!--/containsregexp-->
</fileset>
</length>
<then>
<delete includeemptydirs="true">
<fileset dir="FileIgonnaDelete">
</fileset>
</delete>
</then>
</if>
</target>
To search and delete - means seek and destroy - files in a fileset that do not contain a specific text, use something like :
<delete verbose="true">
<fileset dir="rootdir/to/search" includes="**/*.txt">
<not>
<contains text="findMe"/>
</not>
</fileset>
</delete>
you may use one or more nested resource collections (fileset, dirset ...) within delete.
see Ant manual delete, fileset and selectors for details.

Include/Exclude buildfiles

How do you do this? Given several build files, I only want to include the ones where the target (specified from the command line) exists. Using target::exists in does not seem to work. Thanks.
<target name="*">
<property name="curr.target" value="${target::get-current-target()}"/>
<nant target="${curr.target}">
<buildfiles>
<include name="*.build" if="${target::exists(curr.target)}"/>
<!-- avoid recursive execution of current build file-->
<exclude name="${project::get-buildfile-path()}" />
</buildfiles>
</nant>
</target>
Using robaker's solution, my final build file looks like this. It does not fail anymore if the target is not found in a certain build file (unlike my previous code).
<project>
<include buildfile="A.build"/>
<include buildfile="B.build"/>
<target name="*">
<nant target="${target::get-current-target()}"/>
</target>
</project>
Why not just use the include task to include all your child build scripts instead?

In nant, how to delete contents of a directory, but not the directory itself?

Suppose I were scripting a deployment using nant on a Windows server to a file share: \\server\share. I want a nant script to delete all files from the share then copy in new files.
I have this code to delete the files, but I'm getting an error that it can't delete "\server\share". But I didn't want to delete the share, just the contents in it.
<delete>
<fileset basedir="\\server\share">
<include name="**/**" />
</fileset>
</delete>
Output:
BUILD FAILED
D:\code\xxx\xxx.deploy(177,8):
Cannot delete directory '\\server\share'.
Access to the path '\\server\share' is denied.
If I modified it to instead delete contents of a directory in the share, say \\server\share\somedir, it'll delete "somedir" without error. But still, I didn't want to delete the dir, just the contents. Is there a way?
This works for me - no workarounds required:
<delete>
<fileset basedir="\\server\share">
<include name="**\*" />
</fileset>
</delete>
You could introduce an "exclude" tag and exclude a dummy file. That'll leave the root folder intact.
I'm using the following:
<target name="clean">
<delete>
<fileset basedir="${DeployTo}">
<include name="**/*" />
<exclude name="**/aspnet_client/**" />
</fileset>
</delete>
</target>
Taking cue from nsr81, I was able to come up with this workaround that works for me:
<touch file="${DeployTo}/deleteme" />
<delete>
<fileset basedir="${DeployTo}">
<include name="**/**" />
<exclude name="deleteme" />
</fileset>
</delete>
<delete file="${DeployTo}/deleteme" />

Problem with .cod deployment to simulator

This is a re-post of a topic on the Blackberry Development Forums, but I wasn't getting any answers there, so I thought I would try SO.
I have an in-house library that I developed called Ichabod that is required by one of our applications, Spyder, which runs on the Blackberry 4.5.0 operating system (our original target was for 8330 devices). I had everything working with bb-ant-tools to compile the library, which is in a separate project, and deploy it to C:\Program Files\eclipse\plugins\net.rim.ejde.componentpack4.5.0_4.5.0.21\components\simulator. The Spyder application debugged just fine in the eclipse plugin (I am using Galileo with the 1.1.2 version of the RIM plugin).
Today, however, I went to debug the Spyder application after making a couple of changes to the code (no code changes were made in Ichabod), and found that the application couldn't find the Ichabod module all of a sudden. I noticed that there was now a net.rim.ejde.componentpack4.5.0_4.5.0.28\ directory in my eclipse plugins folder, so thinking that perhaps I updated the component packs without realizing it, I adjusted the target path of the Ichabod library, and rebuilt it with bb-ant-tools. Same problem. So, I tried removing the .cod and all associated files from both the 4.5.0.21 and 4.5.0.28 directories, recompiled the Ichabod library to deploy to both locations, and found that it works with 4.5.0.21, but not with 4.5.0.28 (it's not listed in the modules screen under Settings, either).
I have verified that the .cod file is present in the components\simulator folder, but I can't seem to figure out why the simulators don't recognize the file.
Any suggestions?
My bb-ant-tools build.xml script is attached.
Thanks,
~Scott
<taskdef resource="bb-ant-defs.xml" classpath="lib/bb-ant-tools.jar" />
<property name="jdehome" value="C:\Program Files\eclipse\plugins\net.rim.ejde.componentpack4.5.0_4.5.0.28\components" />
<property name="simulator" value="${jdehome}\simulator" />
<property name="bin" value="${jdehome}\bin" />
<target name="deploy" depends="build" description="Builds and Deploys Project (installs to simulator)">
<copy todir="${simulator}" overwrite="true">
<fileset dir="output">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
</target>
<target name="clean" description="Cleans the output directory">
<delete dir="output"/>
<mkdir dir="output"/>
</target>
<target name="build" depends="clean" description="Builds Project">
<rapc jdehome="${jdehome}"
destdir="output"
output="Ichabod"
quiet="false">
<jdp type="library"
title="Ichabod Library"
vendor="My Company"
version="0.3"
description="Ichabod Library for Mobile Applications"
arguments=""
systemmodule="false"
runonstartup="false"
startuptier="7"
ribbonposition="0">
</jdp>
<src>
<fileset dir=".">
<include name="src/**/*.java" />
<!-- <include name="resource/**/*.*" /> -->
</fileset>
</src>
</rapc>
</target>
</project>
So it appears, after removing the 4.5.0.28 plugin from Eclipse and reinstalling it, that this was what was causing my troubles. I don't know whether this has anything to do with it, but I also removed the JDE 4.5.0 library (which was correctly set at version 28) from the build path of the Ichabod project and replaced it with the same JDE.
After all of this nonsense, my library now shows up in the simulator. Thanks to all who looked at this. Hopefully this will help someone else.