BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Just, a New CLI for Spring Boot Applications

Just, a New CLI for Spring Boot Applications

Just, a command line tool requiring zero configuration, increases the Java development experience while building Spring Boot applications. Just automatically reloads the application when there is a change in source code, build files or Docker compose files. The project also supports the creation of (native) applications and (native) Docker images.

Maciej Walkowiak, freelance architect & developer, released Just exactly eleven months after the first commit. Just itself is a Spring Boot application compiled to a native binary which uses: picocli to create a rich command line application; Testcontainers to run containers in JUnit tests; Sentry for error monitoring; and JReleaser to release the project.

Just uses Spring Boot Devtools which reloads the application after the source code is changed and a build is triggered. On top of Spring Boot Devtools, Just automatically detects source code changes and compiles those changes. Furthermore, whenever the pom.xml or build.gradle change, the application is stopped, the build file refreshed and the application is started again. Unlike Spring Boot Devtools, Just also starts infrastructure services such as databases and services defined via Docker Compose whenever the run sub-command is executed. Just automatically detects the applications build configuration and uses it whenever a just command is executed. It supports Maven and Gradle, but also their respective wrappers and the Maven Daemon. Just execute the run sub-command once and it takes care of the changes in the application.

Comparable to the run sub-command, the build sub-command is translated to the proper Maven or Gradle command with the correct build goal:

just build [--quick] [--skip-test] <buildTarget>

The quick option skips tests, document generation and checks such as formatting and static analysis. Just offers several buildTarget options to create a (native) application or a (native) Docker image: jar, native, image and native-image.

Based on the project's configuration, the format sub-command formats the codebase following the rules of the default settings, Spring Java Format or Spotless configuration.

A running process may be killed with the kill sub-command. By default, the process running on port 8080 is killed. Optionally, a port may be specified with the -p argument and the kill sub-command may be forced by supplying the -9 argument.

Just can be run from the command line or from IntelliJ IDEA by adding a run configuration by executing the init idea sub-command. Alternatively, the run configuration may be added manually by opening the configuration via the Run menu option and clicking on Edit Configurations. Now add a Shell Script and specify the name. The Execute option should be set to Shell Script and the Script Text to just run. After unchecking the Execute in the terminal option, the configuration can be applied. Now the Run menu option shows the name of the new shell script which can be used to start Just.

Just may be installed on MacOs with Homebrew:

brew install maciejwalkowiak/brew/just

Or on Windows with Scoop:

scoop bucket add maciejwalkowiak https://github.com/maciejwalkowiak/scoop-just.git
scoop install just

Alternatively, the application may be installed manually on macOS, Windows or Linux, for example via the Linux command:

curl -Lo just.zip https://github.com/maciejwalkowiak/just/releases/latest/download/just-0.12.0-linux-x86_64.zip && unzip just.zip && chmod +x just && sudo mv just /usr/local/bin/just && just help

The help sub-command may be used to verify the installation.

Just is not an open source project. The GitHub repository contains the binaries, release notes and issue tracker, but not the source code. Currently, the project is still in alpha status and available for free. Each release has a built-in expiration date, after which the application may be purchased or the latest release may be installed.

More information can be found in the Getting Started documentation.

About the Author

Rate this Article

Adoption
Style

BT