Skip to content

linux-china/wukong

Repository files navigation

Wukong - Java Toolchain with Rust

Wukong is a Java toolchain written with Rust.

Why write a Java toolchain with Rust?

  • Startup time matters: Rust is fast, and Java takes ages to start.
  • No environment dependencies: No need to install JDK with different versions.
  • Binary file size matters: small size, easy to distribute. GraalVM native-image is not small enough.

Get started

  • Install: cargo binstall wukong. Please run cargo install cargo-binstall first.
  • JBang-rs: Run Java code ~/.cargo/bin/jbang --help
  • SDKMAN-rs: Manage JDK and tools ~/.cargo/bin/sdk --help
  • Maven Central Search: Artifact search ~/.cargo/bin/mcs --help
  • JAR file analyzer: artifact analyzer ~/.cargo/bin/jarviz --help
  • Maven Toolchains: ~/.cargo/bin/mt --help
  • jenv-rs: ~/.cargo/bin/jenv --help

Java Toolchains

SDKMAN-rs

Please add eval $(~/.cargo/bin/sdk init) to your shell profile.

enhancements

  • CI friendly: sdk install -y java for auto-install
  • Silent mode: sdk -q install java
  • Major version support(Temurin by default): sdk install java 21, sdk use java 21

Difference

  • use version: eval $(sdk use java 21)

Maven Toolchains CLI

  • jdks: list all installed JDKs
  • vendors: list all vendors and available JDK versions.
  • list: list JDKs from ~/.m2/toolchains.xml
  • add: add JDK into ~/.m2/toolchains.xml
  • remove: remove JDK from ~/.m2/toolchains.xml

Add JDK

  • list all vendors and jdk versions: mt vendors
  • mt add 21: add JDK 21 from $HOME/.jbang/cache/jdks/21
  • mt add 17.0.4-tem: add JDK from $HOME/.sdk/candidates/java/17.0.4-tem
  • mt add /path/to/java-home: add JDK from /path/to/java-home

jarviz

jarviz is a JAR file analyzer written in Rust, and inspired by kordamp/jarviz.

  • bytecode matric: jarviz bytecode matrix
  • bytecode show: jarviz bytecode show --pom
  • entries list: jarviz entries list --file=path/to/jarfile.jar
  • services list: jarviz services list --pom

direnv integration

Integration with direnv by sdk direnv init:

  • Java Home: .java-version, .sdkmanrc
  • Aut candidate home and path for SDKMAN: .sdkmanrc

References

About

Wukong: a command-line toolchain for Java with Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published