quarkiverse / quarkus-helm

Quarkus Extension to generate the Helm artifacts
Apache License 2.0
10 stars 8 forks source link

Inconsistent constantpool data in classfile #290

Closed mattagohni closed 10 months ago

mattagohni commented 10 months ago

Hi there, I hope I'm correct here. After upgrading this package in my project from 1.1.0 to 1.2.0 I get the following for me rather exotic error:

Inconsistent constant pool data in classfile for class io/dekorate/helm/config/HelmChartConfigFluent. Method 'io.dekorate.helm.config.HelmChartConfigFluent withDescription(java.lang.String)' at index 858 is CONSTANT_MethodRef and should be CONSTANT_InterfaceMethodRef

Some googling pointed to breaking changes in libraries which cause such behaviour. Honestly I'm not sure how I can work around this, since all tips I foud tell me to mvn clean build but that doesn't work for me. Here is a stackoverflow link (sadly rather old 13+years)

https://stackoverflow.com/questions/1980452/what-causes-java-lang-incompatibleclasschangeerror

When I downgrade to 1.1.0 everything works fine. The error appears durin build-phase (tests are all green).

here is my configuration for the quarkus-maven-plugin (in version 3.5.0). I'm currently using Java 17.

<build>
  <plugins>
     <plugin>
           <groupId>io.quarkus</groupId>
           <artifactId>quarkus-maven-plugin</artifactId>
           <version>${quarkus-maven-plugin.version}</version>
           <executions>
               <execution>
                    <goals>
                         <goal>build</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
  </plugins>
</build>

Is there anything I can do? For now I will stay on 1.1.0, but I would like to upgrade at some point in time. :) Thx for any help in advance!

Sgitario commented 10 months ago

This issue is very similar to https://github.com/quarkiverse/quarkus-helm/issues/287, and Quarkus Helm 1.2.0 was meant to fix the incompatibility class issue.

However, I've never seen the Inconsistent constant pool data error. Can you share a reproducer? so I can deep into it. Otherwise, can you check the reproducer from https://github.com/quarkiverse/quarkus-helm/issues/287#issuecomment-1785078837 and see what is different?

mattagohni commented 10 months ago

Thx for the quick response. Sadly, my project is internal, but I will try to recreate a generic project to reproduce this. Hope I can update here tomorrow!

mattagohni commented 10 months ago

Hi @Sgitario , I have created an empty maven-project with the exact dependencies I'm using in my internal project. The problem is reproducable with this repo.

https://github.com/mattagohni/quarkus-helm-incositant-pool-data

There are 2 branches:

Hope this helps, if I can provide further assistance, let me know. :)

Sgitario commented 10 months ago

Hi @Sgitario , I have created an empty maven-project with the exact dependencies I'm using in my internal project. The problem is reproducable with this repo.

https://github.com/mattagohni/quarkus-helm-incositant-pool-data

There are 2 branches:

  • main: here quarkus-helm is installed in 1.2.0 and the github-Action reproduces the error
  • with-downgraded-quarkus-helm : here quarkus-helm is installed in 1.1.0 . The build with github-Action is green as expected.

Hope this helps, if I can provide further assistance, let me know. :)

The problem is that you're not really using Quarkus 3.5.0 (you're only using the Quarkus Maven plugin 3.5.0). Because you're declaring:

<dependency>
                <groupId>io.quarkiverse.operatorsdk</groupId>
                <artifactId>quarkus-operator-sdk-bom</artifactId>
                <version>${quarkus-sdk.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

Where quarkus-sdk.version is 6.3.3, this bom is enforcing Quarkus 3.2.6.Final (note that you can confirm it running mvn quarkus:dependency-tree. And Quarkus 3.2.6.Final is not compatible with Quarkus Helm 1.2.0 as you're experiencing.

The right Maven configuration when you're installing Quarkiverse dependencies is:

<properties>
    <compiler-plugin.version>3.11.0</compiler-plugin.version>
    <maven.compiler.release>17</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <quarkus.platform.version>3.5.0</quarkus.platform.version>
    <skipITs>true</skipITs>
    <surefire-plugin.version>3.1.2</surefire-plugin.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.quarkus.platform</groupId>
        <artifactId>quarkus-bom</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>io.quarkus.platform</groupId>
        <artifactId>quarkus-operator-sdk-bom</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.quarkiverse.helm</groupId>
      <artifactId>quarkus-helm</artifactId>
      <version>1.2.0</version>
    </dependency>
    <dependency>
      <groupId>io.quarkiverse.operatorsdk</groupId>
      <artifactId>quarkus-operator-sdk</artifactId>
    </dependency>
....
</dependencies>
<build>
    <plugins>
      <plugin>
        <groupId>io.quarkus.platform</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus.platform.version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
              <goal>generate-code</goal>
              <goal>generate-code-tests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
....

With the above configuration, your reproducer now works fine. I'm closing the ticket, but let me know if this is still not working for you!

mattagohni commented 10 months ago

thx, for your explanation and your support. This explains a lot. :)

mattagohni commented 10 months ago

Your hint solved my problem. 🎉 Thx again for your support!