It is supported, but you must be careful when you compile the DRL resources.
You will have to compile the declares first and ensure that the classloader is set correctly.
The easiest way to achieve this is to use the CompositeKnowledgeBuilder:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.batch()
                .add( ResourceFactory.newByteArrayResource( declares.getBytes() ), ResourceType.DRL )
                .add( ResourceFactory.newByteArrayResource( rules.getBytes() ), ResourceType.DRL )
                .build();
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );


Adjust the number and type of resources as needed.

Notice that this feature is only available in more recent versions. If you want/need to use
an older one, could you please specify which version and post the snippet of code
you are using to build the KB?
Thanks!

Davide


On 12/18/2013 05:40 PM, wtang wrote:
I have a .drl rule file with many declare in it to define my own types.  I
compile this file every time.  I want to separate the declare types out of
its own file since the types don't change and just leave the rules in the
original .drl file.

I create my own declares.drl and pulled all the declare from the rule.drl
file and inside the rule.drl file I just did import.  While my declares.drl
file compile with no errors, I am getting types not resolve error from my
.drl file event thought I have the import.

Does drool support the separation of types into its own file and rule file
just refer to those declared types?



--
View this message in context: http://drools.46999.n3.nabble.com/separating-drl-declare-type-from-actual-drl-rule-into-each-own-file-tp4027359.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users