for #java what is the best framework to build native compiled cli applications?

micronaut, quarkus, other?

I don't have time to learn #golang or #rustlang but do want this to have a small footprint and few dependencies.

@cwensel
Use what you know. Any simple Java application can be compiled to native image. Just avoid reflection.

@infosec812 should have phrased it better..

i'm really after an opinionated framework + toolchain that is easy to leverage the Graal vm tools for native compilation.

last time I tried to use these things out of the box I kept pulling in dependencies that couldn't be compile to native (log4j for example).

this time I want to use dependencies that are know to work or are optimized for native compilation.

@cwensel
Well, I cannot speak much to Micronaut or Helidon, but @quarkusio has a module specifically for PicoCLI with native image https://quarkus.io/extensions/io.quarkus/quarkus-picocli/
Picocli

Develop command line applications with Picocli

@cwensel
Also, I struggle to imagine why you need a framework for a CLI application. They're typically designed for web applications.

@cwensel I have had good success using Micronaut+PicoCli. Have not tried any other.

https://micronaut-projects.github.io/micronaut-picocli/latest/guide/

EDIT: Adding a sample personal project that I was working on a couple years ago. Seems to still compile fine to a native GraalVM image. Github here: https://github.com/psumiya/jcli

Micronaut Picocli Configuration

@sumiya I dig picocli. Thanks for the pointers.

@cwensel we recently used #picocli and I can't recommend it enough!

https://picocli.info/

@overheadhunter yeah it’s my favorite also.

Got another recommendation of micronaut + picocli.

@cwensel yup just saw that. Not sure what micronaut adds that picocli doesn’t cover from your requirements, though.

Make sure to give the tab autocompletion feature a try btw 😍

@overheadhunter I’m worried about losing time making graalvm work with the libraries. See my other clarifying comment on toolchain. Having a set of workable dependencies has been more difficult than anticipated in the past.

@cwensel we used picocli with graalvm's native-image without any problem. If you need an example project, here you go:

https://github.com/cryptomator/hub-cli

All native image related stuff is either in the pom.xml or github actions yml.

GitHub - cryptomator/hub-cli

Contribute to cryptomator/hub-cli development by creating an account on GitHub.

GitHub
@cwensel
I have use Quarkus + Picocli in a couple of small CLI tools, and it works wonderfully: it takes care of everything including compressing the executable.