在安装Spring Boot CLI时,受到了Ruby的干扰

首先

想要使用Spring Boot CLI运行Groovy应用程序时,
被”Ruby Gem”的”Spring”所干扰,
导致无法使用Spring Boot CLI的命令”spring run”,
因此将解决方案记下来。

解决方法

1. 要将Spring Boot CLI的路径添加到环境变量中

请在.zshrc文件中添加以下的两行(根据您的环境将.zshrc转换为.bashrc等)。

export SPRING_HOME=/Users/Y_h/spring-1.5.6.RELEASE
export PATH=$SPRING_HOME/bin/:$PATH

刷新更改将通过 source ~/.zshrc 在 zsh 配置文件中生效。

2. 进行 Spring Boot CLI 的操作验证

$ spring

在终端中输入…

usage: spring [--help] [--version]
       <command> [<args>]

Available commands are:

  run [options] <files> [--] [args]
    Run a spring groovy script

  test [options] <files> [--] [args]
    Run a spring groovy script test

  grab
    Download a spring groovy script's dependencies to ./repository

  jar [options] <jar-name> <files>
    Create a self-contained executable jar file from a Spring Groovy script

  war [options] <war-name> <files>
    Create a self-contained executable war file from a Spring Groovy script

  install [options] <coordinates>
    Install dependencies to the lib/ext directory

  uninstall [options] <coordinates>
    Uninstall dependencies from the lib/ext directory

  init [options] [location]
    Initialize a new project using Spring Initializr (start.spring.io)

  shell
    Start a nested shell

Common options:

  -d, --debug Verbose mode
    Print additional status information for the command you are running


See 'spring help <command>' for more information on a specific command.

如果显示出来,就没问题了
辛苦了,自己

最後

只要仔细看安装指南上写的,我就陷入了困境。

广告
将在 10 秒后关闭
bannerAds