Skip to content

Instantly share code, notes, and snippets.

@wes-o
Last active February 4, 2020 21:19
Show Gist options
  • Save wes-o/b51a3129dffea24af8e0674d0d41d43a to your computer and use it in GitHub Desktop.
Save wes-o/b51a3129dffea24af8e0674d0d41d43a to your computer and use it in GitHub Desktop.
How to install the Spring Boot CLI (OS- Independent)

Spring Boot + CLI + Groovy ⛲ 👢 🎺 🎷

Spring Boot for stand-alone, production-grade Spring-based Applications that you can run. 🏃

How to get started (updated for Java 8)

  1. Check your dependencies:
# Check for Java SDK > v1.8
java --version

As stated in the Spring CLI docs: Alternatively, you should set the JAVA_HOME environment variable to point to a suitable JDK

# Check for Maven > v3.3 
mvn --version
  1. Download the Spring CLI distribution from the Spring software repository

(here)[https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.2.2.RELEASE/spring-boot-cli-2.2.2.RELEASE-bin.zip]

# Navigate to the directory where you downloaded the Spring CLI
cd ~/Downloads
# Extract .zip file (make sure you update to your specific version downloaded)
jar xf spring-boot-cli-2.2.2.RELEASE-bin.zip 
# Add environmental variables to your PATH
cd ~
ls -l .bash_profile
  1. Add environmental variable for the current user:
# Add <your-PATH> to Spring Boot CLI /bin folder to your .bash_profile
nano .bash_profile
# Add the following line to .bash_profile (for Windows, flip to backslash '\') e.g. "\Users\...\...\...\bin:$PATH")
export PATH="/Users/<your-user-name>/Downloads/spring-2.2.2.RELEASE/bin:$PATH"
# Now WRITE OUT, SAVE, and EXIT 
Ctrl-O
'Enter'
Ctrl-X
  1. Refresh the Terminal and test your installation:
source .bash_profile
# Test your Spring CLI install
spring --version
  1. Happy Spring-ing! ⛲

What can I do no next?

A whole set of useful tasks!

  • Discover a few commands with:
spring shell
  • Run Groovy scripts directly from command line:
spring run <Spring-Groovy-ScriptName>
  • Use Maven to build executable Java-Spring applications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment