dcdh opened a new issue, #6357:
URL: https://github.com/apache/incubator-kie-drools/issues/6357
**Current behavior**
I've got this kind of rule unit **rules.drl** inside my resource folder
```drl
package org.acme;
unit HomeRuleUnitData;
import org.acme.*;
declare Person
name : String
end
rule "No lights on while outside"
when
$l: /lights[ powered == true ];
not( /smartphones );
then
alerts.add(new Alert("You might have forgot one light powered on: " +
$l.getName()));
end
query "AllAlerts"
$a: /alerts;
end
rule "No camera when present at home"
when
accumulate( $s: /smartphones ; $count : count($s) ; $count >= 1 );
$l: /cctvs[ powered == true ];
then
alerts.add(new Alert("One CCTV is still operating: " + $l.getName()));
end
```
When I want to inject a **KieRuntimeBuilder** because I want to fire
programmatically another rules from a decision table it fails because no bean
is present.
**Expected behavior**
I may intend to trigger rules from different way. But maybe I am wrong and
it is not possible to do it this way.
**Additional information**
The implementation of KieRuntimeBuilder is automatically generated from the
**drools-model-codegen**
The generation is done via
https://github.com/apache/incubator-kie-drools/blob/85e510fb18681f82a6595769730dba47488fc68d/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/KieSessionModelBuilder.java#L59C32-L59C40
This bloc code will not generate it if at least one rule unit is detected
https://github.com/apache/incubator-kie-drools/blob/85e510fb18681f82a6595769730dba47488fc68d/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/project/RuleCodegen.java#L79
```java
if (!droolsModelBuilder.hasRuleUnits()) {
if (kieBaseModels != null) {
if (hasKieModule(context.getAppPaths().getPaths())) {
LOGGER.warn("The Kie Module configuration has been
provided externally, so the existing kmodule.xml file will be ignored.");
}
generatedFiles.addAll(new KieSessionModelBuilder(context(),
droolsModelBuilder.packageSources(), kieBaseModels).generate());
} else {
KieSessionModelBuilder kieSessionModelBuilder = new
KieSessionModelBuilder(context(), droolsModelBuilder.packageSources());
generatedFiles.addAll(kieSessionModelBuilder.generate());
this.kieBaseModels =
kieSessionModelBuilder.getKieBaseModels();
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]