最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】VSCode调试Java弹框提示:Maven executable not found in PATH Please specifiy maven.executable.path in Settings

Java crifan 6284浏览 0评论
折腾:
【未解决】VSCode调试java报错:message: ‘<>’ operator is not allowed for source level below 1.7
期间,感觉是需要先去解决:
之前vscode第一次调试java时,弹框让我设置Maven配置:
Maven executable not found in PATH. Please specifiy maven.executable.path in Settings.
来源:Maven for Java (扩展)
当时没理会maven的提醒。
去重启VSCode,希望还会弹出对应提示,再去设置
果然可以:
最开始 问题 部分显示:目前尚未在工作区检测到问题。
稍等片刻,就能显示出检测出的各种问题了:
点击 Open Settings
Apache Maven Compiler Plugin – Setting the -source and -target of the Java Compiler
Apache Maven Compiler Plugin – Introduction
VSCode Maven executable not found in PATH. Please specifiy maven.executable.path in Settings
Support the setting of ‘maven.executable.path’ in vscode workspace folder settings · Issue #79 · microsoft/vscode-maven · GitHub
Maven for Java – Visual Studio Marketplace
Maven Explorer
The extension scans pom.xml in your workspace, and displays all Maven projects and their modules in the sidebar.
所以可以直接在当前目录下,新建pom.xml,然后加上配置?
但是新建之前,还是要去搞懂 java 和maven,至少是此处VSCode中,是否一定要用maven,以及如何设置
VSCode搭建Java开发运行环境 – zhaoshizi – 博客园
然后去:
【记录】VSCode中参考java的官网教程确认调试环境配置是否正确
然后去:
【未解决】VSCode中如何安装gradle和配置build.gradle
结果期间发现:
本身就有个pom.xml在项目根目录了。自己没注意到而已。
-》所以之前项目本身就是用了maven的
所以还是改去用已经有的pom.xm:
 
XML extension is recommended to check the syntax when editing pom.xml.
来源:Java Extension Pack (扩展)
Installing redhat.vscode-xml…
后来安装好了:
Successfully installed redhat.vscode-xml.
此处已有的
src/refer/java/iec_analysis/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <groupId>iec-analysis</groupId>
    <artifactId>analysis</artifactId>
    <version>1.0-SNAPSHOT</version>


    <!--    引入junit,使用单元测试-->
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>


</project>
所以去搜:
Maven executable not found in PATH Please specifiy maven.executable.path in Settings
突然感觉,需要mac中去安装和配置maven?
vscode install maven
【已解决】mac中安装maven
然后重启VSCode
结果还提示:
看来还是没从PATH中找到mvn
此处故意不去设置
重启Mac,看看是否生效。
重启VSCode,多试了几次,不是关闭VSCode项目窗口,而是完全退出再打开VSCode。
最后终于不弹框maven提示了:
【总结】
此处,VSCode中,打开java项目,右下角提示maven,是因为:
此处mac中没安装maven。
去mac中安装maven:手动从官网下载最新版二进制包,解压,加路径到PATH中。重启VSCode,即可解决问题。
详见:
【已解决】mac中安装maven

转载请注明:在路上 » 【已解决】VSCode调试Java弹框提示:Maven executable not found in PATH Please specifiy maven.executable.path in Settings

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.167 seconds, using 22.15MB memory