先安装必要的插件
然后在左下角setting 打开setting 配置setting.json文件 ,主要是配置了用户设置
这里面主要配置jdk环境和maven,建议下载vscode推荐的openjdk轻量
这个就是总体配置,下面贴出来代码
{
"terminal.integrated.shell.windows": "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe",
"window.zoomLevel": 0,
"workbench.editor.enablePreview": false,
"editor.minimap.enabled": false,
"workbench.iconTheme": "vscode-great-icons",
"workbench.editor.enablePreviewFromQuickOpen": false,
"editor.renderIndentGuides": false,
"editor.highlightActiveIndentGuide": false,
"maven.executable.path": "D:\SoftWare\eclipse\apache-maven-3.6.1\bin\mvn",
"java.configuration.maven.userSettings": "D:\SoftWare\eclipse\apache-maven-3.6.1\conf\settings.xml",
"maven.terminal.customEnv": [
{
"environmentVariable": "JAVA_HOME",
"value": "C:\Program Files\Java\jdk1.8.0_181"
}
],
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.jdt.ls.vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication",
"explorer.confirmDelete": false
}
里面jdk和maven的路径自己替换下,就可以愉快开发了
如果长时间间断使用vscode开发,我是同时把项目在eclipse下和vscode中一块使用,到后面会偶然的出现无法用vscode启动项目的问题:build fail
百度了下,需要做一个类似eclipse中的maven clean 操作
参考地址:https://github.com/redhat-developer/vscode-java/wiki/Troubleshooting#clean-the-workspace-directory
在vscode界面 ctril+shift+p 或者F1 输入java:clean选中后右下角选择restart and delete 重启后就好了