vscode搭建springboot开发环境
1. JDK,Maven
1.1 下载略
1.2 设置系统环境变量
jdk
增加环境变量JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191(安装路径)
增加路径Path=%JAVA_HOME%\bin
检测命令:java -version javac
maven
增加环境变量MAVEN_HOME=D:\soft\apache-maven-3.6.1 (解压路径)
增加路径Path=%MAVEN_HOME%\bin
检测命令 mvn -v
1.3 更换maven镜像仓库
在路径D:\soft\apache-maven-3.6.1\conf\settings.xml的mirrors中增加阿里仓库:
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> <mirrorOf>central</mirrorOf> </mirror>
配置仓库存放本地路径
<localRepository>D:\maven\repository\repo</localRepository>
2 VS Code配置
2.1 安装插件 Java Extension Pack
安装此插件时会同时安装下列关联插件:
- Language Support for Java(TM) by Red Hat
- Java Extension Pack
- Java Test Runner
- Maven for Java
2.2 安装插件 Spring Boot Extension Pack
安装此插件时会同时安装下列关联插件:
- Spring Boot Tools
- Cloudfoundry Manifest YML Support
- Concourse CI Pipeline Editor
- Spring Initializr Java Support
2.3 修改配置文件 setting.json
//java jdk地址 "java.home": "C:\\Program Files\\Java\\jdk1.8.0_191", //mvaen配置文件路径 "java.configuration.maven.userSettings": "D:\\soft\\apache-maven-3.6.1\\conf\\settings.xml", //maven命令执行路径 "maven.executable.path": "D:\\soft\\apache-maven-3.6.1\\bin\\mvn.cmd", "maven.terminal.useJavaHome": true, "maven.terminal.customEnv": [ { "environmentVariable": "JAVA_HOME", "value": "C:\\Program Files\\Java\\jdk1.8.0_191" } ],
3. spring boot项目创建、运行、调试