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.
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.