Maven M2_HOME set to an invalid directory (Windows 7)

后端 未结 16 2352
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 00:59

I\'ve tried installing Maven to Windows 7 with poor results. Some basic info:

Maven installation directory: C:\\Program Files\\Apache Software Foundation\\ap

16条回答
  •  醉话见心
    2020-12-06 01:10

    In my case the setup was correct:

    Windows System Variables:

    • M2 C:\dev\software\apache-maven-3.3.9\bin
    • M2_HOME C:\dev\software\apache-maven-3.3.9

    Windows User variables:

    • %M2_HOME%\bin

    But I had the same problem when there was two installation of maven even though all references was pointing to the latest version which in my case was 3.3.9. After deleting the older version the same command recognised maven.

    BEFORE:

    maven -v
    ERROR: M2_HOME is set to an invalid directory.
    M2_HOME = "C:\dev\software\apache-maven-3.3.9"
    Please set the M2_HOME variable in your environment to match the
    location of the Maven installation
    

    AFTER:

    maven -v
    Apache Maven 3.3.9
    Maven home: C:\dev\software\apache-maven-3.3.9
    Java version: 1.7.0_51, vendor: Oracle Corporation
    Java home: C:\Program Files\Java\jdk1.7.0_51\jre
    

提交回复
热议问题