我敢肯定,尽管拥有相同的技术堆栈,但您还是从事使用不同版本的工具的不同项目。无论您是作为前端开发人员,后端开发人员还是DEVOPS的工作,此问题都可以在任何地方发生。在各种工具的版本之间切换可能会很棘手和痛苦。在本文中,我决定整理有助于减轻这种痛苦的工具。
每当我需要在版本之间切换时,我都会搜索如何进行操作。本文我将作为私人备忘单。如果您每天使用以下工具,我鼓励您保存此帖子并像我一样对待它。
切换Terraform版本-tfenv
安装
# Mac OS
brew install tfenv
基本命令
# list all installed terraform versions
tfenv list
# list all available terraform versions for installation
tfenv list-remote
# install selected terraform version
tfenv install 1.3.6
# switch to installed terraform version
tfenv use 1.3.6
# print currently set terraform version
tfenv version-name
# uninstall selected terraform version
tfenv uninstall 1.0.11
切换Java,Maven和Gradle版本-sdkman
安装
curl -s https://get.sdkman.io | bash
基本命令
# list all installed and installable versions
sdk list java
sdk list maven
sdk list gradle
# install selected version
sdk install java 17.0.5-zulu
sdk install maven 3.8.6
sdk install gradle 7.6
# switch to installed version
sdk use java 17.0.5-zulu
sdk use maven 3.8.6
sdk use gradle 7.6
# print currently set version
sdk current java
sdk current maven
sdk current gradle
# uninstall selected version
sdk uninstall java 8.0.352-zulu
sdk uninstall maven 3.6.0
sdk uninstall gradle 7.4
# list all tools whose versions sdkman can manage
sdk list
切换节点和NPM版本-nvm
安装
# Mac OS
brew install nvm
mkdir ~/.nvm
# support for Oh My ZSH
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
source ~/.zshrc
基本命令
# list all installed node versions
nvm ls
# list all available node versions for installation
nvm ls-remote
# install selected node version and switch to them
nvm install v19.2.0
# install latest LTS node version
nvm install --lts
# switch to installed node version
nvm use v19.2.0
# print currently set node version
nvm current
# uninstall selected node version
nvm uninstall v10.15.3
我将在发现这种类型的其他工具时扩展本文。如果您使用任何其他版本管理工具,请在评论中告诉我,我很乐意看看。