-
Notifications
You must be signed in to change notification settings - Fork 424
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
GraalVM Native Image does not include MixIn options #850
Comments
Thanks for raising this and the many details!That doesn’t sound good. I’ll look at this as soon as I get to my PC. |
Thank you for the fast reply! The code is available here https://github.com/ngeor/instarepo/tree/java-gradle-rewrite if you want to have a look (work in progress). |
…reflect-config.json` by `picocli-codegen` annotation processor.
@ngeor Thanks again for raising this. I was able to reproduce it and it was a real bug. Please clone the project, and build it with |
Hi @remkop , I just did it and now the options appear as expected. Great work! |
@ngeor Glad to hear that! |
@remkop oh don't worry about it at all. I'm totally new to GraalVM. After this fix you provided I got further exceptions originating either in okhttp or my local openJDK and I gave up with GraalVM for now :D |
I see. Hopefully picocli is still useful to you even without GraalVM. :-) |
Actually I’m writing an article on the feasibility of using picocli + GraalVM for writing native CLI apps and I’m interested in the difficulties you encountered. Could you share some details? Can I reproduce them with your project? |
@ngeor Something I noticed yesterday while I looked at your project: you might be interested in using the See the mixinStandardHelpOptions docs and version docs. All strings may contain system properties and other variables. |
So I think picocli works fine, my code crashes further down where it tries to use okhttp to make a call to GitHub's REST API. As soon as I run into an error, I google about it and apply whatever workaround I find. The first problem was that the latest okhttp (v4) didn't work because (according to the internets) it's in Kotlin. I downgraded to version 3 (still Java) and my code still compiled. The second problem was something about missing a charset UTF_32 or so. The workaround was to add this option to the gradle-graal plugin: And now it's something about TLS not present:
and some suggested workaround said to copy over certificates from Oracle into the OpenJDK files (at which point I gave up). |
Ok... with the help of this article I was able to solve the TLS issue:
|
Nice! Any reason you're not using the latest version of GraalVM (19.2.1)? |
I missed that one, thanks :-) I tried it and it works the same. |
FYI: There is some discussion here and here on how to avoid shipping libsunec.so with your native image and still have SSL support.
|
I'm closing this ticket because there is no more work remaining for the "Mixins on GraalVM" problem, but we can continue to discuss further here or on a new ticket if you like. |
Awesome, thank you for fixing this! |
In case it can help somebody, I am going to leave this here as I stumbled upon this thread when googling my problem. I had a similar issue with GraalVM native-image when trying to use Picocli to make a CLI that will serialize objects to YAML files using Jackson (an OpenAPI document). The Jackson MixIn registered within the swagger-core lib didn't seem to be taken into consideration, and it was leaking import io.quarkus.runtime.annotations.RegisterForReflection
import io.swagger.v3.core.jackson.mixin.ExampleMixin
import io.swagger.v3.core.jackson.mixin.MediaTypeMixin
import io.swagger.v3.core.jackson.mixin.SchemaMixin
import io.swagger.v3.oas.models.examples.Example
import io.swagger.v3.oas.models.media.MediaType
import io.swagger.v3.oas.models.media.Schema
@RegisterForReflection(targets=[
MediaType::class,
MediaTypeMixin::class,
Example::class,
ExampleMixin::class,
Schema::class,
SchemaMixin::class,
// ... more classes...
])
class Configuration {
} |
I'm very new in both picocli (fantastic tool!) and GraalVM. I'm using a Mixin to reuse options across multiple sub-commands. This works as expected when running the app with Java. When packaging the app with GraalVM native image, the Mixin options are missing.
Expected result: my CLI app should offer the same options, regardless of whether the app is run via Java or packaged via GraalVM
Actual result: the app does not offer reusable mixin options when packaged via GraalVM
Some versions:
Java: 1.8
OS: Fedora 30
Building with: Gradle 5.6.3
Picocli: 4.0.4
GraalVM: 19.0.2.1
This is the main Command Line (just pulls-in various sub-commands):
This is the list command:
and this is the mixin:
The
GitProvider
is an enum.I have Gradle configured regarding the annotation processor:
Note that I had to remove from
compilerArgs
the${project.group}/
that is mentioned in the documentation.When I build the project, I see that I have a
reflect-config.json
which indeed lacks the mixin fields.Direct option fields (not via a mixin) are included:
This is the output of my cli app generated by GraalVM (it lacks the mixin options):
and this is the output when I run it with Java (it has the extra options that are offered via the mixin):
The text was updated successfully, but these errors were encountered: