Я новичок в Drools; Я пытаюсь выучить Drools на примерах, но, похоже, что-то не так с моими настройками, потому что я не могу запустить свое приложение успешно.
Вот мое правило:
package com.example.rules
import newexample.Person;
rule "Is of valid age"
when
$p : Person( age < 18 )
then
$p.setValid( false );
end
И настройка:
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" packages="rules">
<ksession name="ksession-rule"/>
</kbase>
</kmodule>
Когда я пытаюсь запустить свое приложение, я получаю эту ошибку:
... - Adding Service org.drools.compiler.kie.builder.impl.KieServicesImpl
... - Adding Service org.drools.compiler.builder.impl.KnowledgeBuilderFactoryServiceImpl
... - Found kmodule: file:/.../poc-drools/target/scala-2.12/test-classes/META-INF/kmodule.xml
... - KieModule URL type=file url=/.../poc-drools/target/scala-2.12/test-classes
... - Unable to find pom.properties in /.../poc-drools/target/scala-2.12/test-classes
... - As folder project tried to fall back to pom.xml, but could not find one
... - Unable to load pom.properties from/.../poc-drools/target/scala-2.12/test-classes
... - Cannot find maven pom properties for this project. Using the container's default ReleaseId
... - Discovered classpath module org.default:artifact:1.0.0
... - KieModule was added: FileKieModule[releaseId=org.default:artifact:1.0.0,file=/.../poc-drools/target/scala-2.12/test-classes]
... - File 'rules/1th.drl' is in folder 'rules' but declares package 'com.example.rules'. It is advised to have a correspondance between package and folder names.
... - Unable to build KieBaseModel:defaultKieBase
Rule Compilation error : [Rule name='Is of valid age']
com/example/rules/Rule_Is_of_valid_age734850681.java (1:0) : The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
com/example/rules/Rule_Is_of_valid_age734850681.java (1:0) : The type java.io.Serializable cannot be resolved. It is indirectly referenced from required .class files
com/example/rules/Rule_Is_of_valid_age734850681.java (3:136) : Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
com/example/rules/Rule_Is_of_valid_age734850681.java (6:369) : java.lang.Exception cannot be resolved to a type
Я использую Scala 2.13, SBT 1.2.6, JVM 1.8 и MacOS
Я установил JVM с sdkamn
.
Когда я начинаю проект с Maven все работает найти! но с sbt я получаю упомянутую ошибку.