dekorateio / dekorate

Tools for generating Kubernetes related manifests.
Apache License 2.0
471 stars 101 forks source link

Build step io.quarkus.kubernetes.deployment.KubernetesProcessor#build threw an exception: java.lang.IncompatibleClassChangeError: class io.dekorate.tekton.config.TektonConfigFluent has interface io.dekorate.kubernetes.config.ApplicationConfigurationFluent as super class #1243

Closed cmoulliard closed 11 months ago

cmoulliard commented 11 months ago

Issue

I added to a Quarkus 3.3.2 Hello RESTEasy application the dependency about tekton annotation

    <!-- Dekorate -->
    <dependency>
      <groupId>io.dekorate</groupId>
      <artifactId>tekton-annotations</artifactId>
      <version>3.7-SNAPSHOT</version>
    </dependency>

and when I compiled the project, I got this error:

./mvnw clean package

[WARNING] [io.quarkus.arc.deployment.SplitPackageProcessor] Detected a split package usage which is considered a bad practice and should be avoided. Following packages were detected in multiple archives: 
- "io.fabric8.tekton.triggers.internal.knative.pkg.apis.duck.v1" found in [io.fabric8:tekton-model-triggers-v1alpha1::jar, io.fabric8:tekton-model-triggers-v1beta1::jar]
- "io.fabric8.tekton.triggers.internal.knative.pkg.apis" found in [io.fabric8:tekton-model-triggers-v1alpha1::jar, io.fabric8:tekton-model-triggers-v1beta1::jar]
[INFO] [io.quarkus.kubernetes.deployment.PropertyUtil] Kubernetes manifests are generated with 'The container port http' having default value '8080'. The app and manifests will get out of sync if the property 'quarkus.http.port' is changed at runtime.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  17.537 s
[INFO] Finished at: 2023-09-22T17:42:31+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.3.3:build (default) on project hello: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.kubernetes.deployment.KubernetesProcessor#build threw an exception: java.lang.IncompatibleClassChangeError: class io.dekorate.tekton.config.TektonConfigFluent has interface io.dekorate.kubernetes.config.ApplicationConfigurationFluent as super class
[ERROR]         at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:506)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:506)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
[ERROR]         at io.dekorate.tekton.config.TektonConfig.newTektonConfigBuilderFromDefaults(TektonConfig.java:219)
[ERROR]         at io.dekorate.tekton.config.DefaultTektonConfigGenerator.<init>(DefaultTektonConfigGenerator.java:33)
[ERROR]         at io.dekorate.tekton.config.DefaultTektonConfigGeneratorFactory.create(DefaultTektonConfigGeneratorFactory.java:26)
[ERROR]         at io.dekorate.tekton.config.DefaultTektonConfigGeneratorFactory.create(DefaultTektonConfigGeneratorFactory.java:23)
[ERROR]         at io.dekorate.Session.loadConfigurationGenerators(Session.java:127)
[ERROR]         at io.dekorate.Session.getSession(Session.java:102)
[ERROR]         at io.quarkus.kubernetes.deployment.KubernetesProcessor.lambda$build$2(KubernetesProcessor.java:157)
[ERROR]         at java.base/java.util.Optional.ifPresent(Optional.java:178)
[ERROR]         at io.quarkus.kubernetes.deployment.KubernetesProcessor.build(KubernetesProcessor.java:142)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:578)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:1623)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
[ERROR] 

Question: Do we have to override the fabric8 kubernetes client dependency or another ?

@iocanel

iocanel commented 11 months ago

Dekorate is not meant to be used directly in Quarkus as it used internally by quarkus-kubernetes extension and it may trigger version conflicts (as is the case).

Your options at the moment is to wait until Quarkus is updated with dekorate 4.x and the most recent version of the client. Or wait for tekton manifest generation via the Quarkus CLI which is currently in the works.

iocanel commented 11 months ago

@cmoulliard: backported the fix to 3.x and kicked 3.7.3, will close the issue once it reaches central

iocanel commented 11 months ago

@cmoulliard 3.7.3 is on central and does address this issue. Enjoy!

cmoulliard commented 11 months ago

Problem is perhaps fixed using 3.7.3 but if I execute ./mvn clean package, a kubernetes.yaml is populated but dot not include the tekton ! @iocanel

iocanel commented 11 months ago

Problem is perhaps fixed using 3.7.3 but if I execute ./mvn clean package, a kubernetes.yaml is populated but dot not include the tekton ! @iocanel

Ok, let's create a new issue for that and link it here.