Am 16.09.2011 16:15 schrieb "TroyL" <troylparrish(a)aol.com>:
I am attempting to build a PKG utilizing an Ant Script. My DRL includes
two
declared types. When the declared types have only one field the PKG
will
compile but when the declared types have more than one field I get an
error
stating that a class of that name was already found on the class path
:
specifically the error states:
[compiler] Duplicate type definition. A class with the name XXXXXXX was
found in the classpath while trying to redefine the fields in the declare
statement. Fields can only be defined for non-existing classes.
Hi,
please optimize your signal/noise ratio:
* try to reduce your use case to a minimal test case which still exhibits
the erroneous behaviour
* a self contained unit test would be perfect
* try compiling the files from your use case using a plain KnowledgeBuilder.
As the Ant task is merely a wrapper around it, try to reproduce the
erroneous behaviour with the simplest setup possible.
* put the rule source code into your test as string literals.
* reduce the rule source code as much as possible while still reproducing
the error
* then, identify the smallest rule source code delta which makes the error
go away.
If you finally manage to reproduce the error using this minimal setup, make
sure to include complete information. In particular, don't XXX out parts of
the error message.
I'm quite sure if you follow at least some of these hints, you will probably
get more feedback from this list.
Best regards,
Ansgar
My ant script:
<?xml version="1.0" encoding="UTF-8" ?>
<project default="rules">
<property name="projectPath" value="" />
<property name="droolsPath"
value="C:/Users/266571/Documents/drools-distribution-5.2.0.Final/binaries"
/>
<property name="eclipsePath"
value="C:/Users/266571/Documents/eclipse/plugins" />
<path id="drools.classpath">
<pathelement location="${droolsPath}/drools-ant-5.2.0.FINAL.jar" />
<pathelement location="${droolsPath}/drools-api-5.2.0.jar" />
<pathelement location="${droolsPath}/drools-core-5.2.0.FINAL.jar" />
<pathelement location="${droolsPath}/drools-compiler-5.2.0.FINAL.jar"
/>
<pathelement
location="${droolsPath}/antlr-runtime-3.3.jar" />
<pathelement location="${droolsPath}/mvel2-2.0.19.jar" />
<pathelement location="${droolsPath}/knowledge-api-5.2.0.Final.jar"
/>
<pathelement
location="${eclipsePath}/org.eclipse.jdt.core_3.6.2.v_A76_R36x.jar" />
</path>
<path id="model.classpath">
<pathelement location="bin" />
</path>
<taskdef name="compiler" classpathref="drools.classpath"
classname="org.drools.contrib.DroolsCompilerAntTask" />
<target name="rules" >
<compiler
srcdir="${projectPath}src/rules"
tofile="${projectPath}src/rules/rules.pkg"
binformat="package"
classpathref="model.classpath" >
<include name="supportObjects.drl" />
</compiler>
</target>
</project>
My DRL:
package gov.ssa.codedObjects
import gov.ssa.codedObjects.SupportObjectsCollection;
declare SecondaryBrain
name : String
id : int
end
declare ICDCode
code : String
name : String
end
global SupportObjectsCollection supportObjectsList;
rule "Evaluate Coded Object"
when
$codedObject : CodedObject(code == 191.0)
then
SecondaryBrain brain = new SecondaryBrain();
brain.setName("Brain Tumor, Cerebrum");
insert (brain);
end
rule "Evaluate Coded Object Malignent"
when
$codedObject : CodedObject(code == "239.6" || code ==
"C71.9", $code :
code)
then
ICDCode code = new ICDCode();
code.setCode($code);
code.setName("Neoplasm of uspecified nature of the Brain");
insert(code);
end
rule "Add Brain Neoplasm to List"
when
$code : ICDCode(code == "239.6" || code == "C71.9")
then
supportObjectsList.addToSupportObjects($code);
end
rule "Megaduodenum"
when
$codedObject : CodedObject(code == "537.3" || code ==
"K59.3", $code :
code)
then
ICDCode code = new ICDCode();
code.setCode($code);
code.setName("Megaduodenum");
insert(code);
end
rule "Add Megaduodenum to List"
when
$code : ICDCode(code == "537.3" || code == "K59.3")
then
supportObjectsList.addToSupportObjects($code);
end
Any suggestions would be helpful.
--
View this message in context:
http://drools.46999.n3.nabble.com/Ant-Build-of-PKG-with-Declared-Types-tp...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users