Spring boot CLI is a spring command line tool which can help you develop spring application quickly and easily. It utilize spring’s start dependence and automation configuration features, then developer can focus on the business logic code, do not need to care about the project jars dependency and configuration. This article will tell you how to install spring boot CLI on MacOS, Linux and Windows.
1. Install Spring Boot CLI Manually.
This method is useful for both MacOS, Linux and Windows.
- Go to spring boot getting started and installation page and download spring-boot-cli-2.1.0.BUILD-SNAPSHOT-bin.zip.
- Unzip the downloaded file to a local folder. You can find there is a bin folder under it. There are two executable file, one is spring( for Mac or Linux ) the other is spring.bat( for Windows ).
- Open a terminal and execute below command to add above bin folder to current system environment variable PATH’s value.
# Go to user home directory. $ cd ~ $ ls -l .bash_profile # Edit .bash_profile file. $ vim .bash_profile # Add spring boot CLI bin folder to system environment variable PATH value and save .bash_profile file. $ export PATH="/Users/zhaosong/Downloads/spring-2.1.0.BUILD-SNAPSHOT/bin:$PATH" # Make above change effective. $ source .bash_profile
- To verify spring boot cli installation correctly, run
spring --versionin terminal.
localhost:~ $ spring --version Spring CLI v2.0.2.RELEASE
- Run spring boot CLI shell. You can run commands in spring boot cli shell, you can execute a lot of CLI command in the shell and press TAB key to auto complete cli shell commands.
2. Install Spring Boot CLI On MacOS Use HomeBrew.
- Ensure HomeBrew is installed in your MacOS.
localhost:~ $ brew -v Homebrew 1.7.4 Homebrew/homebrew-core (git revision cc23; last commit 2018-09-11)
- Install pivotal’s tap to add additional software ( such as spring boot cli ) on Mac.
localhost:~ $ brew tap pivotal/tap Updating Homebrew... ==> Tapping pivotal/tap Cloning into '/usr/local/Homebrew/Library/Taps/pivotal/homebrew-tap'... ......
Install spring boot cli use HomeBrew.
localhost:~$ brew install springboot Updating Homebrew...
Spring boot will be installed in /use/local/bin folder.
Then you can run
spring shellto run spring boot cli commands.