<p><br>
Am 16.09.2011 16:15 schrieb &quot;TroyL&quot; &lt;<a href="mailto:troylparrish@aol.com">troylparrish@aol.com</a>&gt;:<br>
&gt;<br>
&gt; I am attempting to build a PKG utilizing an Ant Script.  My DRL includes two<br>
&gt; declared types.  When the declared types have only one field the PKG will<br>
&gt; compile but when the declared types have more than one field I get an error<br>
&gt; stating that a class of that name was already found on the class path :<br>
&gt; specifically the error states:<br>
&gt;<br>
&gt; [compiler] Duplicate type definition. A class with the name XXXXXXX was<br>
&gt; found in the classpath while trying to redefine the fields in the declare<br>
&gt; 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&#39;t XXX out parts of the error message.</p>
<p>I&#39;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>&gt;<br>
&gt; My ant script:<br>
&gt;<br>
&gt;  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br>
&gt; &lt;project default=&quot;rules&quot;&gt;<br>
&gt;  &lt;property name=&quot;projectPath&quot; value=&quot;&quot; /&gt;<br>
&gt;  &lt;property name=&quot;droolsPath&quot;<br>
&gt; value=&quot;C:/Users/266571/Documents/drools-distribution-5.2.0.Final/binaries&quot;<br>
&gt; /&gt;<br>
&gt;  &lt;property name=&quot;eclipsePath&quot;<br>
&gt; value=&quot;C:/Users/266571/Documents/eclipse/plugins&quot; /&gt;<br>
&gt;<br>
&gt;<br>
&gt;  &lt;path id=&quot;drools.classpath&quot;&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/drools-ant-5.2.0.FINAL.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/drools-api-5.2.0.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/drools-core-5.2.0.FINAL.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/drools-compiler-5.2.0.FINAL.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/antlr-runtime-3.3.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/mvel2-2.0.19.jar&quot; /&gt;<br>
&gt;    &lt;pathelement location=&quot;${droolsPath}/knowledge-api-5.2.0.Final.jar&quot; /&gt;<br>
&gt;    &lt;pathelement<br>
&gt; location=&quot;${eclipsePath}/org.eclipse.jdt.core_3.6.2.v_A76_R36x.jar&quot; /&gt;<br>
&gt;<br>
&gt;  &lt;/path&gt;<br>
&gt;  &lt;path id=&quot;model.classpath&quot;&gt;<br>
&gt;    &lt;pathelement location=&quot;bin&quot; /&gt;<br>
&gt;  &lt;/path&gt;<br>
&gt;      &lt;taskdef name=&quot;compiler&quot; classpathref=&quot;drools.classpath&quot;<br>
&gt;          classname=&quot;org.drools.contrib.DroolsCompilerAntTask&quot; /&gt;<br>
&gt;              &lt;target name=&quot;rules&quot; &gt;<br>
&gt;                 &lt;compiler<br>
&gt;                   srcdir=&quot;${projectPath}src/rules&quot;<br>
&gt;                   tofile=&quot;${projectPath}src/rules/rules.pkg&quot;<br>
&gt;                   binformat=&quot;package&quot;<br>
&gt;                     classpathref=&quot;model.classpath&quot; &gt;<br>
&gt;              &lt;include name=&quot;supportObjects.drl&quot; /&gt;<br>
&gt;        &lt;/compiler&gt;<br>
&gt;    &lt;/target&gt;<br>
&gt;<br>
&gt;<br>
&gt; &lt;/project&gt;<br>
&gt;<br>
&gt; My DRL:<br>
&gt;<br>
&gt; package gov.ssa.codedObjects<br>
&gt;<br>
&gt; import gov.ssa.codedObjects.SupportObjectsCollection;<br>
&gt;<br>
&gt; declare SecondaryBrain<br>
&gt;<br>
&gt;        name : String<br>
&gt;        id : int<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt; declare ICDCode<br>
&gt;<br>
&gt;        code : String<br>
&gt;        name : String<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt; global SupportObjectsCollection supportObjectsList;<br>
&gt;<br>
&gt; rule &quot;Evaluate Coded Object&quot;<br>
&gt;<br>
&gt;        when<br>
&gt;                $codedObject : CodedObject(code == 191.0)<br>
&gt;        then<br>
&gt;                SecondaryBrain brain = new SecondaryBrain();<br>
&gt;                brain.setName(&quot;Brain Tumor, Cerebrum&quot;);<br>
&gt;                insert (brain);<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt; rule &quot;Evaluate Coded Object Malignent&quot;<br>
&gt;<br>
&gt;        when<br>
&gt;                $codedObject : CodedObject(code == &quot;239.6&quot; || code == &quot;C71.9&quot;, $code :<br>
&gt; code)<br>
&gt;<br>
&gt;        then<br>
&gt;                ICDCode code = new ICDCode();<br>
&gt;                code.setCode($code);<br>
&gt;                code.setName(&quot;Neoplasm of uspecified nature of the Brain&quot;);<br>
&gt;                insert(code);<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; rule &quot;Add Brain Neoplasm to List&quot;<br>
&gt;<br>
&gt;        when<br>
&gt;                $code : ICDCode(code == &quot;239.6&quot; || code == &quot;C71.9&quot;)<br>
&gt;        then<br>
&gt;                supportObjectsList.addToSupportObjects($code);<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt; rule &quot;Megaduodenum&quot;<br>
&gt;<br>
&gt;        when<br>
&gt;                $codedObject : CodedObject(code == &quot;537.3&quot; || code == &quot;K59.3&quot;, $code :<br>
&gt; code)<br>
&gt;<br>
&gt;        then<br>
&gt;                ICDCode code = new ICDCode();<br>
&gt;                code.setCode($code);<br>
&gt;                code.setName(&quot;Megaduodenum&quot;);<br>
&gt;                insert(code);<br>
&gt;<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt; rule &quot;Add Megaduodenum to List&quot;<br>
&gt;<br>
&gt;        when<br>
&gt;                $code : ICDCode(code == &quot;537.3&quot; || code == &quot;K59.3&quot;)<br>
&gt;        then<br>
&gt;                supportObjectsList.addToSupportObjects($code);<br>
&gt;<br>
&gt; end<br>
&gt;<br>
&gt;<br>
&gt; Any suggestions would be helpful.<br>
&gt;<br>
&gt; --<br>
&gt; 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>

&gt; Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</p>