配置vscode支持java-maven
参照资料:https://blog.csdn.net/wgh295360998/article/details/83990107
setting.json
// 指定搜索maven项目时要排除的文件夹 "maven.excludedFolders": [ "**/.*", "**/node_modules", "**/target", "**/bin", "**/archetype-resources" ], // 建议小部件的字号,如果设置为0,则使用'editor.fontSize'的值 "editor.suggestFontSize": 0, // 针对makefile语言,配置替代编辑器设置 "[makefile]":{ "editor.insertSpaces": false }, "java.errors.incompleteClasspath.severity": "ignore", "java.home": "/Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home", "java.configuration.maven.userSettings": "/Users/a123/Documents/env/apache-maven-3.8.1/conf/setting.xml", "maven.executable.path": "/Users/a123/Documents/env/apache-maven-3.8.1/bin/mvn", "maven.terminal.useJavaHome": true, "maven.terminal.customEnv": [{ "environmentVariable": "JAVA_HOME", "value": "/Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home" }], "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m", "javascript.updateImportsOnFileMove.enabled": "always", "explorer.confirmDelete": false, "java.project.importOnFirstTimeStartup": "automatic", "files.exclude": { "**/.classpath": true, "**/.project": true, "**/.settings": true, "**/.factorypath": true }, "redhat.telemetry.enabled": true
1、windows注意点
① 通过,vscode安装jdk16 。 需要安装maven但可以不配置环境变量。
② 配置
{ "workbench.iconTheme": "vscode-icons", "workbench.startupEditor": "newUntitledFile", "java.errors.incompleteClasspath.severity": "ignore", "workbench.colorTheme": "Atom One Dark", "java.home":"C:\\Java\\jdk1.8.0_131", "java.configuration.maven.userSettings": "H:\\Maven\\apache-maven-3.5.0\\conf\\settings.xml", "maven.executable.path": "H:\\Maven\\apache-maven-3.5.0\\bin\\mvn.cmd", "maven.terminal.useJavaHome": true, "maven.terminal.customEnv": [ { "environmentVariable": "JAVA_HOME", "value": "C:\\Java\\jdk1.8.0_131" } ], }
③ maven的setting
< !-- 在mirrors 中配置 mirror -->推荐使用maven阿里仓库:在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>