原因
- Idea启动慢,过于冗杂,VsCode很轻量
- 有时需要启动前端代码,不想使用Idea
- 逃离Idea的破解版魔咒,哈哈哈
- 最近在学Rust,Idea对Rust的支持不是很好
建议大家还是看看,里面有比较完备的介绍 官方文档
插件
- Extension Pack for Java
- 只用下载第一个,其他的会自动下载
- Language Support for Java有点坑,这个得要Java 11才行,官网上没看到他们说的0.6.x的历史版本
- 不过不影响使用Java 1.8
- Spring Boot Extension Pack
- 这也是个全家桶
- 这也是个全家桶
插件设置
Ctrl + Shift + P
,输入setting,选择JSON
{
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"c:\\Users\\15881\\.vscode\\extensions\\gabrielbb.vscode-lombok-1.0.1\\server\\lombok.jar\"",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "D:/Dev/jdk1.8.0_191",
"default": true //默认使用这个
},
{
"name": "JavaSE-11",
"path": "D:/Dev/jdk-11.0.15.10-hotspot"
}
],
"redhat.telemetry.enabled": true,
"spring.initializr.defaultLanguage": "Java",
"spring.initializr.defaultJavaVersion": "8",
"spring.initializr.defaultPackaging": "JAR",
"java.configuration.maven.globalSettings": "D:\\Dev\\apache-maven-3.5.0\\conf\\settings.xml", //maven setting.xml路径,里面可以指定maven下载依赖的保存路径
"java.maven.downloadSources": true,
"java.maven.updateSnapshots": true,
"maven.dependency.enableConflictDiagnostics": true,
"maven.settingsFile": "D:\\Dev\\apache-maven-3.5.0\\conf\\settings.xml", //感觉和上面差不多,还是都设置了吧
"spring-boot.ls.java.home": "D:/Dev/jdk1.8.0_191",
"window.zoomLevel": 2,
"java.codeGeneration.generateComments": true,
"java.codeGeneration.useBlocks": true,
"java.completion.guessMethodArguments": true,
"java.debug.settings.forceBuildBeforeLaunch": false,
"java.debug.settings.hotCodeReplace": "manual",
"java.templates.typeComment": [
"/**",
" * Roushan",
" * ${year}/${month}/${day} ${time}",
" */"
]
}
配置启动文件
- 配置项目启动Profile
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Launch AppRun",
"request": "launch",
"mainClass": "xx.xxxxxx.xxxxxRun",
"projectName": "xxxxxxx",
"args": "--spring.profiles.active=local", //选择1
"vmArgs": "-Dspring.profiles.active=xxx" //选择2
}
]
}