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