Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fabric8 generator cli and maven plugin returning different java method names #5955

Open
fhalde opened this issue Apr 25, 2024 · 4 comments
Open
Labels
bug component/java-generator Waiting on feedback Issues that require feedback from User/Other community members

Comments

@fhalde
Copy link

fhalde commented Apr 25, 2024

Describe the bug

We are trying to generate Java classes for the following CRD https://github.com/strimzi/strimzi-kafka-operator/blob/affc1968742a8ab1121d23a64c9247ca5c477a32/install/cluster-operator/041-Crd-kafkaconnect.yaml

We set extraAnnotations configuration to generate the fluent builder pattern. Here is what we are noticing

This CRD has a template field. With the CLI, the builder has correct withTemplate & endTemplate methods
However, with the maven plugin, the builder seems to have withTemplate & endKafkaconnectspecTemplate method

What could be the reason?

Fabric8 Kubernetes Client version

6.12.1

Steps to reproduce

Generate the java sources using both the cli and maven fabric8 generator plugin
e.g. cli

jbang io.fabric8:java-generator-cli:6.12.1 --target="." -add-extra-annotations -always-preserve-unknown --source=kafkaconnects.yaml

Expected behavior

We expected the plugin & the cli to work the same way

Runtime

minikube

Kubernetes API Server version

1.25.3@latest

Environment

Linux, macOS

Fabric8 Kubernetes Client Logs

No response

Additional context

No response

@shawkins
Copy link
Contributor

endKafkaconnectspecTemplate

That is a sundrio bug. We'll need to pickup another release to correct that.

@fhalde
Copy link
Author

fhalde commented Apr 25, 2024

thanks, why would it work fine with the cli though which is also making use of sundrio?

@shawkins
Copy link
Contributor

You must be picking up a different version of sundio that way.

@matteriben
Copy link
Contributor

matteriben commented Apr 25, 2024

I'm not able to reproduce this using the maven plugin. Check which version of sundrio you're using.

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1</version>
  <properties>
    <kubernetes-client.version>6.12.1</kubernetes-client.version>
    <sundrio.version>0.103.1</sundrio.version>
    <lombok.version>1.18.32</lombok.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>kubernetes-client</artifactId>
      <version>${kubernetes-client.version}</version>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>generator-annotations</artifactId>
      <version>${kubernetes-client.version}</version>
    </dependency>
    <!-- extraAnnotations requires these additional dependencies -->
    <dependency>
      <groupId>io.sundr</groupId>
      <artifactId>builder-annotations</artifactId>
      <version>${sundrio.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>java-generator-maven-plugin</artifactId>
        <version>${kubernetes-client.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <source>041-Crd-kafkaconnect.yaml</source>
          <alwaysPreserveUnknown>true</alwaysPreserveUnknown>
          <extraAnnotations>true</extraAnnotations>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

@manusa manusa added the Waiting on feedback Issues that require feedback from User/Other community members label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component/java-generator Waiting on feedback Issues that require feedback from User/Other community members
Projects
None yet
Development

No branches or pull requests

4 participants