JUST – CLI for developing Spring Boot applications
JUST is command line toolkit which greatly simplifies the developing of Spring Boot Applications.
Introducing Just, the go-to command line tool designed to enhance your Spring Boot developer experience! Currently offering the incredible “Just Run” feature.
Get ready for Just Run, the only command you’ll need to kickstart your Spring Boot application in development mode. It seamlessly takes care of:
1. Live reload – Say goodbye to the hassle of rebuilding, recompiling, or restarting applications. Just save your changes in IntelliJ IDEA and watch as Just compiles the updated code, reflecting alterations in mere seconds.
2. Zero-config infrastructure services – Starting infrastructure services like databases and message queues has never been easier. Just detects your application’s connection to a service, launches a docker container, and configures the connection effortlessly. Plus, these services launch only once without impacting live reload performance!
3. Docker compose integration – Utilizing a docker-compose.yml for local development? Just will automatically execute “docker compose up” before launching your application and even live reloads Docker containers whenever the docker-compose.yml file is modified.
4. Project run command selection – Maven or Gradle? Daemon or Wrapper? With Just Run, there’s no need to choose. Everything is determined automatically for you.
Spring Boot projects that require Java 11+ and compatible with Spring Boot Dev tools
Docker if you want to use zero-config infrastructure services or docker compose file
JUST can be installed either using package managers (Homebrew for Mac OS, scoop for Windows) or manually by downloading the binary.
Note: At the moment only x86_64 architectures are supported.
scoop bucket add maciejwalkowiak https://github.com/maciejwalkowiak/scoop-just.gitCode language: Java (java)
scoop install justCode language: Java (java)
Download just-0.12.0-windows-x86_64.zip, unzip it, and place
just.exe in the
brew install maciejwalkowiak/brew/justCode language: Java (java)
curl -Lo just.zip https://github.com/maciejwalkowiak/just/releases/latest/download/just-0.13.0-osx-x86_64.zip && unzip just.zip && chmod +x just && sudo mv just /usr/local/bin/just && just helpCode language: Java (java)
curl -Lo just.zip https://github.com/maciejwalkowiak/just/releases/latest/download/just-0.13.0-linux-x86_64.zip && unzip just.zip && chmod +x just && sudo mv just /usr/local/bin/just && just helpCode language: Java (java)
You can test the installation with following command.
just helpCode language: Java (java)
?????? ???????????????????? ?????? ???????????????????? ?????? ??????????? ??? ?? ?????? ??????????? ??? ????????????????????????? ??? ?????? ??????? ???????? ??? Usage: just [-V] [COMMAND] -V, --version Print Just version Commands: run runs Spring Boot project - either with Maven or Gradle in dev mode with hot reloading enabled help Display help information about the specified command. format formats code with Spotless init initializes Just related files build builds application kill kills process running on portCode language: Java (java)
How it works?
JUST CLI transparently adds Spring Boot Devtools dependency to the project and also monitors the source for changes and starts compilation using Maven or Gradle when it detects a change.
It also responds to changes in build files such as pom.xml or build.gradle; anytime a change occurs, it pauses the Spring Boot application, refreshes the build file, and restarts the application. Because of this, you may execute run only once, amend any source file, and the programme will take care of reflecting the changes.
JUST CLI also starts the its own server on random available port
Now let’s look at the how to use Just CLI.
You have to run following commands from the root of the project.
just runCode language: Java (java)
The above command launches Spring Boot application in the development mode with live reload, Docker Compose Support and zero config infrastructure services.
Passing command line arguments to Maven/Gradle
Anything that is added after
just run is passed to Maven/Gradle commands. For example, to activate a Maven profile named
$ just run -PlocalCode language: Java (java)
Running just server on fixed port
just run starts the
just server on the random available port. To run it with fixed port, set the environment variable
$ JUST_SERVER_PORT=8081 just runCode language: Java (java)
Running multi-module Maven projects
Just ( from versio 0.13) works with multi-module Maven projects.
$ just run <module-directory>Code language: Java (java)
For example for following project structure:
. ├── application │ └── pom.xml ├── library │ └── pom.xml └── pom.xmlCode language: Java (java)
application module is the one that is meant to be run (it has
@SpringBootApplication annotated class), to run project with just execute:
$ just run applicationCode language: Java (java)
just buildCode language: Java (java)
just build command builds the spring boot project. The command automatically detects Maven or Gradle build tool and picks up the best command to execute (
|builds the jar||mvn package|
|mvn native:compile -Pnative||gradle nativeCompile|
|builds a Docker Image with a native executable||mvn spring-boot:build-image -Pnative||gradle bootBuildImage|
|builds a Docker Image with an executable JAR||gradle bootBuildImage|
just build command can be customized by using just.properties or just.yml file in project root directory.
|Extra command line arguments passed to Maven or Gradle|
|a default target to build when the command is invoked with |
|enables/disables Zero-Config Infrastructure Services feature during the build phase|
just formatCode language: Java (java)
just format formats the code with Spring Java Format or Spotless depending on the plugin configured.
If none of the plugin is configured , it defaults to Spring Java Format.
$ just kill -p 8082Code language: Java (java)
just kill allows you to quickly and easily kill processes that are listening on specific ports. This can be useful if you need to free up a port for a different process, or if you want to stop a process that is no longer needed.
just run command can be customized by using just.properties or just.yml file in project root directory.
|none||This should be used only if Just is unable to identify that the project utilises Spring Boot for some reason. SPRING_BOOT is one of the possible values.|
|true||enables/disables live-reload feature|
|true||enables/disables frontend resources reload without a browser refresh|
|a comma-separated list of Maven profiles to activate (passed with |
|a comma-separated list of Spring Boot profiles to activate (as |
|true||enables/disables Docker Compose feature|
|docker-compose.yml||Docker Compose YML file path relative to project root|
|true||enables/disables Zero-Config Infrastructure Services feature|
Docker Compose support
If your project uses docker compose file to start the database, queue service or any other service, JUST CLI can start the services defined in the docker compose file.
To refresh running containers, just execute docker compose up –remove-orphans whenever there is a change in docker-compose.yml
The zero-config infrastructure services capability is immediately disabled when Docker Compose support is enabled and a docker-compose.yml file exists.
Docker Compose support can be disabled through setting a property in
just.run.docker-compose.enabled=falseCode language: Java (java)
Docker Compose file name and path can be customized with property:
just.run.docker-compose.file=services.ymlCode language: Java (java)
Zero Config Infrastructure Services
just run command, communicates with Just server to start infrastructure services whenever a configuration property for such service is not set.
For example, if you add
spring-boot-starter-data-jpa and a JDBC driver for PostgreSQL but you do not set
spring.datasource.url property in
application.properties, Just will automatically download docker image of Postgres Database and start database and set all
spring.datasource.* properties needed by the application to connect to Postgres.
To start zero config services JUST CLI internally makes use of Tesstcontainers libraries.
This applies to following infrastructure services:
Infrastructure Services can be disabled through setting a property in
just.run.services.enabled=falseCode language: Java (java)
If are using zero config infrastructure , you can customize the properties like image and port to be used and enable/disable services.
|enables/disables starting PostgreSQL database when requested|
|enables/disables logging SQL queries by PostgreSQL (experimental)|
|PostgreSQL Docker Image Name|
|TCP port on which PostgreSQL is exposed|
|enables/disables starting MySQL database when requested|
|MySQL Docker Image Name|
|TCP port on which MySQL is exposed|
|enables/disables starting RabbitMQ when requested|
|RabbitMQ Docker Image Name|
|TCP port on which RabbitMQ is exposed|
|TCP port on which RabbitMQ Management Console is exposed|
|enables/disables starting Neo4j database when requested|
|Neo4j Docker Image Name|
|TCP port on which Neo4j is exposed|
|enables/disables starting MongoDB database when requested|
|MongoDB Docker Image Name|
|TCP port on which MongoDB is exposed|
|enables/disables starting Redis database when requested|
|Redis Docker Image Name|
|TCP port on which Redis is exposed|
|enables/disables starting Zipkin when requested|
|Zipkin Docker Image Name|
|TCP port on which Redis is exposed|