美文网首页
Mac M1 VSCode中Maven配置

Mac M1 VSCode中Maven配置

作者: Leo_23 | 来源:发表于2022-06-06 07:58 被阅读0次

    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"
            }
        ]
    }
    

    相关文章

      网友评论

          本文标题:Mac M1 VSCode中Maven配置

          本文链接:https://www.haomeiwen.com/subject/mendmrtx.html