micronaut-core: default cli-app project doesn't work with GraalVM because of PicoCLI
I tried building a native image for a blank cli-app project generated with the mn
command and it doesn’t work at runtime because of the way PicoCLI works
I was using micronaut 1.0.0.RC2
and graalvm 1.0.0-rc7-graal
(both installed with SDKMan)
I had to switch to the Clikt library (for Kotlin) and then I was able to generate a native-image for my cli-app
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 23 (21 by maintainers)
Update:
picocli-codegen
3.7.0 is now available from Maven Central.The
picocli-codegen
README now has usage instructions with code snippets for Gradle and Maven to generate acli-reflect.json
file automatically as part of the build.@graemerocher I believe this goes a long way towards what you are looking for in terms of tooling to make Micronaut + Graal work more out of the box. What is left is documentation:
picocli-codegen
README. See PR https://github.com/micronaut-projects/micronaut-core/pull/760native-image -H:ReflectionConfigurationFiles
option takes multiple comma-separated files, so users can specify both the config file generated manually withGraalClassLoadingAnalyzer
and the one generated during the build bypicocli-codegen
. See PR https://github.com/micronaut-projects/micronaut-core/pull/761@t-buss One way to fix the problem is to add the
'info.picocli:picocli:4.0.0-alpha-3'
dependency to thegenerateConfig
classpath.Alternatively use the same version of picocli and
picocli-codegen
that is on the runtime classpath to generate the reflect-config.Hi, not sure if this is really resolved, as I am running in some problems that seem to be related:
This seems to be an error with the reflective access of PicoCLI. I also tried what the PicoCLI README suggested and added dependencies and Gradle task:
which resulted in this error message:
Help would be appreciated, and I would also volunteer to update the docs accordingly. Thanks in advance!
@remkop ok no worries, will do manual merge