cmd输入
/usr/libexec/java_home
找到你的java的home目录,(没用)
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
找到你的maven配置文件,我放在
/usr/local/apache-maven-3.8.3/
VSCode添加插件
Maven for Java
,
Java Extension Pack
,
Spring Boot Extension Pack
,
Language Support for Java(TM) by Red Hat
用了Java8的版本发现vs不支持提示,
插件要求用Java17版本以上才可以看到提示,我就去下载了新的17的LTS版本
Java17
打开VSCode的settings.json
,加入配置
{
"java.jdt.ls.java.home":"/Library/Java/JavaVirtualMachines/jdk-17.0.3.1.jdk/Contents/Home",
"java.configuration.maven.userSettings":"/usr/local/apache-maven-3.8.3/conf/settings.xml",
"maven.executable.path":"/usr/local/apache-maven-3.8.3/bin/mvn",
"maven.terminal.useJavaHome":true,
"maven.terminal.customEnv":[
{
"environmentVariable":"JAVA_HOME",
"value":"/Library/Java/JavaVirtualMachines/jdk-17.0.3.1.jdk/Contents/Home"
}
]
}
网友评论