Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-7792

Project fails to build if no SW file is defined and Knative Eventing and Kubernetes add-on is presented in classpath

XMLWordPrintable

    • False
    • None
    • False
    • ---
    • ---
    • 2022 Week 32-34 (from Aug 8), 2022 Week 35-37 (from Aug 29), 2022 Week 38-40 (from Sept 19)

      Given a project is created via Quarkus Maven plugin with the extensions kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,quarkus-kubernetes and the option -DnoCode:

      mvn io.quarkus.platform:quarkus-maven-plugin:2.11.2.Final:create -DprojectGroupId=org.acme -DprojectArtifactId=sw1 -DnoCode -DplatformVersion=2.11.2.Final -Dextensions=kogito-quarkus-serverless-workflow,kogito-addons-quarkus-knative-eventing,quarkus-kubernetes
      

      This means no SW file in the resources folder.

      When we try to build it:

      mvn -DskipTests -Dquarkus.container-image.build=false -Dquarkus.container-image.push=false clean install
      

      The following NPE happens:

      2022-08-19 13:44:41,455 docker_builder.py:103        INFO  Docker: [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.11.2.Final:build (default) on project kogito-sw-base: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      [error]: Build step org.kie.kogito.addons.quarkus.knative.eventing.deployment.KogitoProcessKnativeEventingProcessor#buildMetadata threw an exception: java.lang.NullPointerException
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at org.kie.kogito.addons.quarkus.knative.eventing.deployment.KogitoProcessKnativeEventingProcessor.buildMetadata(KogitoProcessKnativeEventingProcessor.java:63)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:977)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
      2022-08-19 13:44:41,456 docker_builder.py:103        INFO  Docker: [ERROR]      at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      2022-08-19 13:44:41,457 docker_builder.py:103        INFO  Docker: [ERROR]      at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      2022-08-19 13:44:41,457 docker_builder.py:103        INFO  Docker: [ERROR]      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      2022-08-19 13:44:41,457 docker_builder.py:103        INFO  Docker: [ERROR]      at java.base/java.lang.Thread.run(Thread.java:829)
      2022-08-19 13:44:41,457 docker_builder.py:103        INFO  Docker: [ERROR]      at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      2022-08-19 13:44:41,457 docker_builder.py:103        INFO  Docker: [ERROR] -> [Help 1]
      

      The problem is in this line.

      The most straightforward approach is to add a guard check in this function and return if processContainerBuildItem is null.

      Although, the problem is that the codegen engine adds the process generator, skips the generation but the BuildSteps that require KogitoProcessContainerGeneratorBuildItem are still getting called.

      Ideally, these BuildSteps shouldn't be called.

            vmudadla@redhat.com Vani Haripriya Mudadla
            rhn-support-zanini Ricardo Zanini Fernandes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: