This fails:-
*Test
*
package com.guvnor.tests;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderErrors;
import org.drools.io.ResourceFactory;
import org.drools.lang.descr.PackageDescr;
public class FragmentsTest {
public static final void main(String[] args) {
try {
PackageBuilderErrors pbe;
PackageBuilder pb = new PackageBuilder();
pb.addPackage( new PackageDescr( "p3" ) );
pb.addPackageFromDrl( ResourceFactory.newClassPathResource(
"Fragment1.drl" ) );
pbe = pb.getErrors();
System.out.println("Errors = " + pbe.getErrors().length );
pb.addPackageFromDrl( ResourceFactory.newClassPathResource(
"Fragment2.drl" ) );
pbe = pb.getErrors();
System.out.println("Errors = " + pbe.getErrors().length );
pb.addPackageFromDrl( ResourceFactory.newClassPathResource(
"Fragment3.drl" ) );
pbe = pb.getErrors();
System.out.println("Errors = " + pbe.getErrors().length );
pb.getPackage();
} catch ( Exception e ) {
e.fillInStackTrace();
e.printStackTrace();
}
}
}
*Fragment1.drl
*
package com.guvnor.package3
import com.guvnor.package1.Person
import java.math.BigDecimal
*Fragment2.drl
*
package com.guvnor.package3
//import com.guvnor.package1.Person <<Fails unless I add this import
declare Person
end
declare Person2 extends Person
name : String
age : Integer
end
*Fragment3.drl
*
package com.guvnor.package3
rule "test"
when
Person( salary == 10 )
then
System.out.println("Hello Fred!");
end
Resolved with
https://github.com/droolsjbpm/drools/commit/dc00433f3e3821a2c224ba8dc36f0...