-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to create Builders with java generator? #6659
Comments
You need to add the sundrio and lombok dependencies to your project: https://github.com/fabric8io/kubernetes-client/blob/main/doc/java-generation-from-CRD.md#quick-start-maven Here you can find a working example: https://github.com/marcnuri-demo/kubernetes-client/blob/a3ab4ac552b0932324f0ce97387af2a791850611/java-generator/pom.xml |
is this possible with the cli as well? or only maven? |
the CLI won't generate the builders, it generates source-code that can be processed by the builder generators. |
Thank you for the link you sent. But when I run https://github.com/marcnuri-demo/kubernetes-client/blob/master/java-generator/src/test/java/com/hashicorp/secrets/v1beta1/VaultConnectionTest.java I get
|
ok! didn't know about the annotate-process part! Tx |
Not sure how you're running it, but should simply work by using Maven (
Yes, this is basically the important part. Your builders will be generated as |
yeah tx for the pointer! Actually I'm writing an SBT plugin for the java-generator. The basic POJO generation is there, but since I don't use Maven ever it's a bit getting used to. So, if I'm following this correctly it's the sundr.io plugin that (should) kick in after the pojo is generated and then creates the Builder class based on the annotation of the base class. I'll have a look if I can manage that to work but this might become a rabbithole rather quickly. Thanks for your help! |
That's correct. I guess you can run the compilation of the classes to kick in the APT ( |
I have a CRD from which I generate the Java Classes. I can add annotations to indicate the Builders of these classes, but is there a way to actually generate the Builder classes as well?
Concretely, I generate the following class based on Traefik Middleware CRD with
./java-gen/java-generator-cli-6.13.4.sh -add-extra-annotations -s traefik.io_middlewares.yaml -t .
Very nice, however there is no constructor for
MiddlewareBuilder
created. How can I generate one?The text was updated successfully, but these errors were encountered: