quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.54k stars 2.61k forks source link

The project created in the guide "USING KOGITO TO ADD BUSINESS AUTOMATION CAPABILITIES TO AN APPLICATION" has a build failure #20025

Open hbelmiro opened 3 years ago

hbelmiro commented 3 years ago

Describe the bug

When we create a project following the step-by-step from USING KOGITO TO ADD BUSINESS AUTOMATION CAPABILITIES TO AN APPLICATION and run ./mvnw clean compile quarkus:dev, the build fails with the following exception:

2021-09-09 08:06:04,220 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-9) src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
2021-09-09 08:06:04,221 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-9) src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
2021-09-09 08:06:04,231 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:415)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:275)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:92)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:441)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:65)
    at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:137)
    at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
    at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
    at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

    at io.quarkus.builder.Execution.run(Execution.java:116)
    at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
    at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:151)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:413)
    ... 9 more
Caused by: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThreBossThread.java:501)

I've found that Kogito is not creating the org/drools/project/model/ProjectRuntime.java file. That happens because the method org.kie.kogito.codegen.rules.IncrementalRuleCodegen#generate has a new if statement that prevents the method org.kie.kogito.codegen.rules.IncrementalRuleCodegen#generateProject from being called.

https://github.com/kiegroup/kogito-runtimes/blob/dd989b06770c6e6094adb8f1ad7fced4c1111b6f/kogito-codegen-modules/kogito-codegen-rules/src/main/java/org/kie/kogito/codegen/rules/IncrementalRuleCodegen.java#L179

        if (hasRuleUnits) {
            generateRuleUnits(errors, generatedFiles);
        } else if (context().hasClassAvailable("org.kie.kogito.legacy.rules.KieRuntimeBuilder")) { // <- This condition is returning false
            generateProject(dummyReleaseId, modelsByUnit, generatedFiles);
        }

I'd like to fix the bug myself, but I don't know if the problem is in the above statement or if the PersonsProcess class shouldn't reference the ProjectRuntime class at all.

Versions: Quarkus: 2.2.1.Final Kogito: 1.10.0.Final OpenJDK: 11.0.8

Expected behavior

Build success without any exceptions.

Actual behavior

2021-09-09 08:06:04,220 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-9) src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
2021-09-09 08:06:04,221 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-9) src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
2021-09-09 08:06:04,231 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:415)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:275)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:92)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:441)
    at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:65)
    at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:137)
    at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
    at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
    at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)

    at io.quarkus.builder.Execution.run(Execution.java:116)
    at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
    at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:151)
    at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:413)
    ... 9 more
Caused by: java.lang.IllegalStateException: src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})
src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
src/main/java/org/acme/kogito/PersonsProcess.java (75:3427) : The method ruleFlowGroup(String, Supplier<KieRuntime>) in the type RuleSetNodeFactory<capture#13-of ?> is not applicable for the arguments (String, () -> {})src/main/java/org/acme/kogito/PersonsProcess.java (76:3478) : org.drools.project.model.ProjectRuntime.INSTANCE cannot be resolved to a type
    at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104)
    at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:159)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.compileAndIndexJavaSources(KogitoAssetsProcessor.java:127)
    at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:97)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at org.jboss.threads.JBossThreBossThread.java:501)

How to Reproduce?

Following the guide https://quarkus.io/guides/kogito

Output of uname -a or ver

Darwin Helbers-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.2.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

No response

quarkus-bot[bot] commented 3 years ago

/cc @evacchi, @mariofusco

evacchi commented 3 years ago

I think this is still using the deprecated rule flow group @mariofusco